【发布时间】:2020-11-24 16:44:31
【问题描述】:
我正在使用 chromedriver 进行硒自动化。但是与手动测试相比,网页加载速度非常慢。请帮助
得到错误:
[1596549682.992][SEVERE]: Timed out receiving message from renderer: 300.000
代码试验:
ChromeOptions option=new ChromeOptions();
option.setPageLoadStrategy(PageLoadStrategy.NORMAL);
option.addArguments("--disable-features=NetworkService");
option.addArguments("--dns-prefetch-disable");
option.addArguments("--disable-extensions");
option.setProxy(null);
driver = new ChromeDriver(option);
Chrome 版本:84 Chrome 驱动程序版本:84 Selenium 版本:试过 3.141.59 和 3.5.2
【问题讨论】:
-
为什么需要
--disable-features=NetworkService、--dns-prefetch-disable和--disable-extensions?你的用例是什么? -
我试过这个,因为它是作为解决方案给出的,但它不起作用。我的问题是在运行测试用例时,有时页面会快速加载,但有时会花费太多时间并给出超时异常。我应该向选项添加任何内容。我尝试了 pageloadtimeout 和隐式等待,这也不起作用。
标签: java selenium selenium-webdriver selenium-chromedriver pageloadstrategy