Selenium WebDriver go to page without waiting for page load

前端 未结 1 1509
梦谈多话
梦谈多话 2020-12-30 07:46

I\'m translating some Selenium RC tests to Selenium WebDriver using the python api. In Selenium WebDriver, I\'m noticing that driver.get( \'http://...\' ) seems

相关标签:
1条回答
  • 2020-12-30 08:12

    Yes and no. As of Selenium 2.24.1, the support for this is only in Firefox - you have to run it in a special "mode":

    FirefoxProfile fp = new FirefoxProfile();
    fp.setPreference("webdriver.load.strategy", "unstable");
    WebDriver driver = new FirefoxDriver(fp);
    

    You can even set the timeout if you want to. This method fails in any browser other than Firefox and does nothing in Firefox without the unstable strategy:

    driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
    
    0 讨论(0)
提交回复
热议问题