DEV Community

skptricks
skptricks

Posted on

How To Wait For Page To Load/Ready In Selenium WebDriver

Post Link: How To Wait For Page To Load/Ready In Selenium WebDriver

In this tutorial, we are going to explain how to wait for page to load/ready in selenium webdriver. Generally selenium WebDriver handles web page loading or wait for page to load by It self. But sometime web pages are taking more time to load page, due to that driver script unable to find specified element in web page and that results in issue. So in that case selenium webdriver will throws exception message in console and stop the script execution. Here in this example we are using javascript executor to overcome page load issue and javascript executor also provides predefined function, that helps to check page load status.

How To Wait For Page To Load/Ready In Selenium WebDriver

Javascript execution example to check page loading status :
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("return document.readyState").toString().equals("complete");

Read More...

Top comments (0)