From the course: Using Python for Automation (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Selenium wait functions

Selenium wait functions

- [Instructor] Let's talk about wait functions with Selenium. What are they, and why you need them. So, the problem with scripting modern day websites is many of them use asynchronous techniques, like Ajax, to load their webpages. This method allows web servers to update parts of their webpage without reloading the entire thing. Because of this they're able to create fast loading and dynamic webpages. However, this becomes a problem when our Selenium web driver tries to locate a web element before it's loaded. This will raise an exception with our script and our program will not work. And this transitions us into why we need wait functions. Wait functions can add crucial time intervals in between actions performed, thus allowing the web driver to wait until an element is loaded before it interacts with it. Selenium offers two types of waits, explicit and implicit. Explicit waits, when paired with a condition, will wait until that condition is satisfied before…

Contents