Capability or wait command to make driver wait until app launch

Hi all,

I have appium framework in Appium 2 and having capabilities like below.

UiAutomator2Options android =
                    new UiAutomator2Options()
                            .setAutomationName("uiautomator2")
                            .setDeviceName("xxxxx")
                            .setClearSystemFiles(true)
                            .setAllowTestPackages(true)
                            .setAppWaitDuration(Duration.ofSeconds(100))
                            .setAutoGrantPermissions(true)
                            .setAppWaitForLaunch(true)
                            .setAppActivity(
                                    DataHelper.getPropertyValue("xxxxxx"))
                            .setAppPackage(
                                    DataHelper.getPropertyValue("xxxxx"))
                            .setApp(app.getAbsolutePath())
                            .setPlatformName("Android");

            driver = new AppiumDriver(url, android);
            Serenity.getWebdriverManager().setCurrentDriver(driver);

Sometimes above code fails as app is taking time to launch in emulator and driver is invoked immediately. How make driver wait until app is launched.I used below command at last line but throwing synchronisation error sometimes and driver is not waiting properly.
// driver.manage().timeouts().wait(30000);

Same i need for iOS too?

https://github.com/appium/appium-uiautomator2-driver ->
try increase

  • appium:appWaitDuration (you have)
  • appium:appWaitForLaunch (you have)
  • appium:avdLaunchTimeout
  • appium:avdReadyTimeout
  • appium:uiautomator2ServerLaunchTimeout
  • appium:uiautomator2ServerInstallTimeout
  • appium:uiautomator2ServerReadTimeout

so many to tune ā€¦

1 Like

Thanks Iā€™m setting all for Duration.ofSeconds(200).Hope this is enough. Is there anything for iOS too?