Waits helps the user to solve the issues which comes while redirecting to different web pages, by refreshing the web page and reloading the new web elements. At times there can be Ajax calls as well. So, a time delay occurs while reloading the web pages and reflecting the web elements.
WebDriver provides two types of waits to handle the loading of reappearing page & web element, windows appearance, pop ups and error messages and display of web elements on the web page:
1. WebDriver Implicit Wait:
Implicit waits are utilize to provide a default waiting time into each following test step/command over the complete test script. So, the next test step will be performed when the 30 seconds have passed after the previous test step.
It is a single line code. It can be declared in the setup method of the test script.
Its syntax and approach is simpler.
It is easy and simple to apply but it has some drawbacks as well. It increases the test script execution time as each command will stop to wait for a specified time before restart the execution.
import java.util.concurrent.TimeUnit – We have to import this package before applying the implicit wait.