Wait for page load in Selenium

后端 未结 30 2505
攒了一身酷
攒了一身酷 2020-11-22 07:12

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

30条回答
  •  一生所求
    2020-11-22 08:04

    Use class WebDriverWait

    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"));
    

提交回复
热议问题