3

I'm writing automation test for a android native appilcation,but some parts of the application working only with the capabilty

   //cap.setCapability("automationName", "uiautomator2");

    cap.setCapability("automationName", "uiautomator");

and other parts working only with

cap.setCapability("automationName", "uiautomator2");

So I don't know if I can change the capability

akshay patil
  • 670
  • 7
  • 20
Camilo Avila
  • 83
  • 2
  • 6

2 Answers2

0

Is there a typo in your question? I think you wrote uiautomator2 twice, but I assume you want to switch between uiautomator2 and espresso.

So, you cannot switch the session between automation frameworks, sorry. Both Espresso and UIAutomator2 launch your app when they start a session.

You could break your script into multiple tests, where one test uses one automation style while another test uses the other.

Another option is you could use intents and deep linking to open your app to a particular point. So if your tests needs to run commands like this:

uiautomator2 command
         |
         v
  espresso command
         |
         v
uiautomator2 command
         |
         v
  espresso command

You could create deep links to each of those steps in your app. So start a driver with uiautomator2, perform some actions, then close the driver and start a new espresso session, launching with an android intent that takes you into the app at the second step. Then keep switching this way.

More information on deep linking with appium:

Also look at the appPackage and appActivity desired capabilities

TinyTimZamboni
  • 5,275
  • 3
  • 28
  • 24
-1

I have faced same issue while i am automating native android app and in some places the uiautomator not properly works like not able to click on search button or not able to scroll like that, i searched for 2-3 days and i find out that if we change the capability from uiautomator to uiautomator2 the script that i have written working fine and quite fast automating than uiautomator their will be no problem if you change the capability

akshay patil
  • 670
  • 7
  • 20