How to push app in background and launch from same screen in Appium with selenium

前端 未结 10 977
一向
一向 2021-01-07 06:44

Is there any way to do the following process in android Automation using Appium with android driver?

Press home button from some specific screen. Put app in backgrou

10条回答
  •  情深已故
    2021-01-07 07:37

    Works for me: ((Appium 1.10, Android 8.1))

    2 options:

    1st solution:

    driver.runAppInBackground(Duration.ofMillis(300));
    

    After you close your popUp, you use this line and your app will go to background and back and you will get back the focus to your app.

    2nd solution: better one :)

    Add this line to settings:

    capability.setCapability("noReset", true);
    

    From now your app will start like normal app, without setting reset what means without pop-ups and you will not have problem with focus at all.

    I hope it will work also for you! :)

提交回复
热议问题