Getting Selenium to pause for X seconds

后端 未结 6 2081
小蘑菇
小蘑菇 2020-12-06 16:24

What I am trying to accomplish is browsing to a page, waiting for something to load and then taking and saving a screenshot.

The code I already have is



        
6条回答
  •  借酒劲吻你
    2020-12-06 16:46

    You can locate an element that loads after the initial page loads and then make Selenium wait until that element is found.

    WebDriverWait wait = new WebDriverWait(driver, 10);
    WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("ID")));
    

提交回复
热议问题