Wait for page load in Selenium

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

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

30条回答
  •  迷失自我
    2020-11-22 08:18

    You can also use the class: ExpectedConditions to explicitly wait for an element to show up on the webpage before you can take any action further actions

    You can use the ExpectedConditions class to determine if an element is visible:

    WebElement element = (new WebDriverWait(getDriver(), 10)).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("input#houseName")));
    

    See ExpectedConditions class Javadoc for list of all conditions you are able to check.

提交回复
热议问题