From the course: Advanced Selenium: 3 Synchronization Strategies

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

WebDriverWait usage patterns

WebDriverWait usage patterns - Selenium Tutorial

From the course: Advanced Selenium: 3 Synchronization Strategies

Start my 1-month free trial

WebDriverWait usage patterns

- [Male Voice] We have seen what the WebDriverWait class does. I want spend a little time exploring some basic patterns for using it. The basic patterns we're going to look at are creating a new WebDriverWait for every sync point, a shared local context wait, waiting and returning a value, waiting as an alternative to an assertion, and the shared driver context wait. Just let me sort this so we can see the first example. Now this test is what I'm going to use throughout for all these patterns using the collapsible Dev page, where we go to the page, we click on the Dev to expand it, then we wait somehow for the about link, and then find and click on the link. And here I'm using a thread sleep, so we simply don't want to do this. Now, I gain most flexibility by creating a new wait each time I need it. By adding a sync point everywhere I need it, I can configure the timing as required and that's very explicit in my code…

Contents