Wait for page load in Selenium

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

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

30条回答
  •  花落未央
    2020-11-22 08:13

    I use node + selenium-webdriver(which version is 3.5.0 now). what I do for this is:

    var webdriver = require('selenium-webdriver'),
        driver = new webdriver.Builder().forBrowser('chrome').build();
    ;
    driver.wait(driver.executeScript("return document.readyState").then(state => {
      return state === 'complete';
    }))
    

提交回复
热议问题