Wait for page load in Selenium

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

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

30条回答
  •  心在旅途
    2020-11-22 07:55

    Explicitly wait or conditional wait in this wait until given this condition.

    WebDriverWait wait = new WebDriverWait(wb, 60);
    wait.until(ExpectedConditions.elementToBeClickable(By.name("value")));
    

    This will wait for every web element for 60 seconds.

    Use implicitly wait for wait of every element on page till that given time.

    driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
    

    This will wait for every web element for 60 seconds.

提交回复
热议问题