Selenium在进入新页面之前等待异步资源调用。
例如:
<script src="https://apis.google.com/js/platform.js" async defer></script>
在一个有许多外部API(例如Google Analytics和来自G+、Facebook和Twitter的共享按钮)的网站上,Selenium花费的时间等待异步调用比运行测试所用的时间还要长。是否有办法禁用这种行为,使得Selenium不必等待异步外部API调用呢?
Selenium在进入新页面之前等待异步资源调用。
例如:
<script src="https://apis.google.com/js/platform.js" async defer></script>
FirefoxProfile fp = new FirefoxProfile();
fp.setPreference("webdriver.load.strategy", "unstable");
WebDriver driver = new FirefoxDriver(fp);