I am facing a huge problem while executing 10+ test cases, I have observed that Appium server freezes randomly for around 5-10 seconds and then resumes from the last step only. Now the problem is, during this time if a dynamic element gets displayed like toast message or dialog message that will disappear in 2-3 seconds after invoking, will never able to find it using driver.findElement(By.xpath(“(//android.widget.Toast)[1]”).getAttribute(“name”)); and throw the NoSuchElementFoundException when the Appium resumes automatically. I tried with both implicit wait driver.manage().timeouts().impicitWait(Duration.ofSeconds(10)); and explicit wait wait().until(ExpectedConditions.visibilityOf(“(//android.widget.Toast)[1]”)); and obviously, our good-old Thread.sleep(<desired_time>) after selecting the button so that element can get visible properly.
I checked the logs multiple times, it doesn’t throw any exception or error, It just pauses the whole process for 5-10 seconds. I have tried both approaches.
- Starting the appium server programmatically to start the test execution.
- Started the local appium server manually and test started the test execution.
If anyone can help to resolve this it would be a great help. I would share the logs as well if required.
Note: Android test app doesn’t get stuck or crash during this time.