What is Implicit wait in Selenium WebDriver?
It means that we can tell Selenium that we would like it to wait for a certain amount of time before throwing an exception (when it cannot find the element on the page).
Above statement will set the navigation timeout as 50. This means that selenium script will wait for maximum 50 seconds for page to load. If page does not load within 50 seconds, it will throw an exception.
Logic: – Selenium checks the control in first go, in case it is not able to find the control it will wait for the given implicit time, and then try again, after the end of the wait time to look for the control before throwing an exception. By default, its value is 0.
Limitation: – implicit wait will be applied to all the elements of the test case by default.
- Implicit wait is a single line of a code and can be declared in the setup method of the test script.
- When compared to Explicit wait, Implicit wait is transparent and uncomplicated. The syntax and approach is simpler than explicit wait.
- Implicit wait will not work all the commands/statements in the application. It will work only for “FindElement” and “FindElements” statements
Example for Implicit Wait
Refer below video –
Refer below links to know more about Explicit wait and Fluent wait –
Hope this Helps !!!!!