• +91 9723535972
  • info@interviewmaterial.com

Selenium Interview Questions and Answers

Question - In Selenium, how will you wait until a web page has been loaded completely?

Answer -

There are two methods of making sure that the web page has been loaded completely in Selenium. 

They are as follows :

1. Immediately after creating the webdriver instance, set an implicit wait: 

temp = driver.Manage().Timeouts().ImplicitWait;
On every page navigation or reload, this will try to wait until the page is fully loaded.

2. Call JavaScript return document.readyState till "complete" is returned after page navigation. As a JavaScript executor, the web driver instance can be used. 

Code example:

new WebDriverWait(firefoxDriver, pageLoadTimeout).until(
     webDriver -> ((JavascriptExecutor) webDriver).executeScript("return document.readyState").equals("complete"));

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners