Blog

Wait for page load in Selenium (Python)

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.

wait = WebDriverWait(self.driver, 10)
element = wait.until(ec.visibility_of_element_located((By.ID, "searchInput")))

WebDriver - wait for element using C#

In order to explicitly wait until an element is visible, the most direct and simple way is to use a WebDriverWait object. The following script shows this.

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(driver=>driver.FindElement(By.XPath("//a[strong[.='English']]")));

Pages