Quality Testing

Quality is delighting customers

How to confirm that a page is loaded using Selenium and Webdriver?

How to confirm that a page is loaded using Selenium and Webdriver?

Views: 263

Reply to This

Replies to This Discussion

via the webdriverwait object it is possible to do so:


or if you have jquery and or complex javascript check this example
Jquery javascript


Selenium automatically should wait for page load to complete, however it is applicable for DOM only 

So you can just "wait" for the web element which will allow you to continue testing using Selenium's Explicit Wait feature (for instance you can use WebDriverWait class to ensure that the element is present, visible and "editable" (clickable). 

Also if the application under test is built using one of modern JavaScript frameworks (JQuery, Angular, etc.) you can check whether AJAX requests are still running via WebDriver executeScript() function  

Check out Top 15 UI Test Automation Best Practices You Should Follow article for more information on browser tests automation with Selenium. 

In automation testing company below code is used to check whether the page is loaded completely or not :

static void waitForPageLoad(WebDriver wdriver) {
WebDriverWait wait = new WebDriverWait(wdriver, 60);

Predicate<WebDriver> pageLoaded = new Predicate<WebDriver>() {

public boolean apply(WebDriver input) {
return ((JavascriptExecutor) input).executeScript("return document.readyState").equals("complete");


Hope this will help you in resolving your query .

Thank you everyone!



TTWT Magazine





© 2018   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service