Wait for page load in Selenium (C#)

Wait for page load in Selenium (C#)

To wait until the page is loaded, the easiest way is to use a WebDriverWait to force the driver to wait until an element is visible that you know is only present on the page you are navigating to.You can do this using WebDriverWait.

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
wait.Until(driver=>driver.FindElement(By.Id("searchInput")));

Leave a reply

Your email address will not be published. Required fields are marked*

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.