From the course: Advanced Selenium: Support Classes

Unlock the full course today

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

Ajax and default locator strategies

Ajax and default locator strategies - Selenium Tutorial

From the course: Advanced Selenium: Support Classes

Start my 1-month free trial

Ajax and default locator strategies

- [Instructor] The page objects created by extending the PageFactory using the initElements method to create the proxy web elements. These do not do any synchronization for us by default. We can introduce a level of synchronization by initializing the page with an ElementLocatorFactory from the support classes. When I use Command + P or Control + P in the initElements method, we can see the method signature allows me to use an ElementLocatorFactory. By default, elements are initiated with a default ElementLocatorFactory. Let me click through here, Command-click, or Control-click on Windows, and you can see, on line 79, the default ElementLocatorFactory is being used. This default ElementLocatorFactory does not perform any synchronization, but the support classes also include an AjaxElementLocatorFactory. Then we use Command + N or Control + N, and we'll open up the AjaxElementLocatorFactory. So you can see where it…

Contents