Implicit wait
Implicit wait is a way to tell the Appium driver to poll the DOM (Document Object Model) for a certain amount of time before throwing an exception to the effect that it can't find the element on the page. The default timeout value is set to 0 seconds. Once we set the implicit wait to a specified time, it persists for the life of the webdriver
object instance. How to set an implicit wait is explained here:
appiumDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
So, what this implies is letting the driver instance wait for a maximum of 10 seconds before throwing the NoSuchElement
exception. We need to be watchful about the implicit usage. The Appium boilerplate generally gives us the code with the implicit wait implementation, so note the preceding line in the HomePageWebSteps
class file, as shown:
appiumDriver = new AppiumDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities); appiumDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
Increasing the...