Search code examples
androidseleniumappiumemulationopen-with

Appium - open in browser


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


Solution

  • 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.