![]() |
VOOZH | about |
Modern web applications often use AJAX techniques, where elements on a page may load at different times. This asynchronous loading can make locating elements tricky: if an element is not yet present in the DOM, Selenium will throw an ElementNotVisibleException.
To handle such scenarios, Selenium provides waits, which add a delay between actions like locating elements or performing operations on them. There are two types of waits in Selenium: Implicit Waits and Explicit Waits.
An implicit wait tells Selenium WebDriver to poll the DOM for a certain amount of time when trying to find elements that are not immediately available.
driver.implicitly_wait(time_in_seconds)
Output:
Explanation:
Example 2: Implicit Wait on GeeksforGeeks.
Output:
Explanation: