0

Testing mobile application using appium. When I run to test, my application opens, I can do some action, and then when I login, app takes me to browser to login to the cloud which is OK, but my problem is in the emulator. I have a question that pops-up, Open with Chrome or other app (JUST ONCE / ALWAYS). How can I avoid this dialog?

added below code but this does not help

caps.setCapability("appPackage", "com.android.browser");

I expect that when app switch me to browser then I can paste my credentials and switch back to my application and I can continue my testing

PRERNA PAL
  • 381
  • 2
  • 10
Karol
  • 165
  • 2
  • 6
  • 19

3 Answers3

0

You can trigger KeyEvent to put apps in the background and see the home screen. Then you search for browser icon and click it. Once in browser, you can use the context commands to automate the webview.

After you done with browser, you can resume the native app.

dmle
  • 3,498
  • 1
  • 14
  • 22
0

Sometimes there are some testing that makes us out of the application, Appium provides features for us to switch to the application we want. Please try this method :

driver.startActivity(new Activity("com.example", "ActivityName"));

You must know the name of your application bundle and its main activity. You can read the documentation here.

frianH
  • 7,295
  • 6
  • 20
  • 45
0

I experienced similar popups too when testing apps with Appium. The only solution that works for me is extracting the xpath (UIAutomatorViewer) and perform a click on the popup. There must be a OK or cancel button somewhere. (I do this for app crash popups, chrome privacy stuff, ...)

I perform something like:

if(element.isDisplayed()){
    element.click();
}
//proceed with your test

It is not optimal but it works. Remember if you would test this app manually you would also have to click the popup away, so I think this is OK.

AndiCover
  • 1,724
  • 3
  • 17
  • 38