DEV Community

skptricks
skptricks

Posted on

1 1

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...

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay