LambdaTest Community

Find answers, support, and inspiration from other users

Questions
LambdaTest Community
Answered

Wait for page load in Selenium

How do you make Selenium 2.0 wait for the page to load?

Up Vote Down Vote 0 Votes
Posted 5 months ago

Answers


You can also check pageloaded using following code

IWait<IWebDriver> wait = new OpenQA.Selenium.Support.UI.WebDriverWait(driver, TimeSpan.FromSeconds(30.00));

 wait.Until(driver1 => ((IJavaScriptExecutor)driver).ExecuteScript("return document.readyState").Equals("complete"));

OR

Also see here

You can expect to show some element. something like in C#:

WebDriver _driver = new WebDriver();
WebDriverWait _wait = new WebDriverWait(_driver, new TimeSpan(0, 1, 0));

_wait.Until(d => d.FindElement(By.Id("Id_Your_UIElement"));
Up Vote Down Vote 0 Votes
Posted 4 months ago