0

我正在使用 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

4

1 回答 1

0

Selenium by default implements pageLoadStrategy as NORMAL. So explicitly setting the same won't make any difference.

However, to avoid waiting for the slowly loading webpage you can set the capability java.lang.String PAGE_LOAD_STRATEGY as none as follows:

ChromeOptions option=new ChromeOptions();
option.setPageLoadStrategy(PageLoadStrategy.NONE);
driver = new ChromeDriver(option);

References

You can find a couple of relevant detailed discussions in:


Timed out receiving message from renderer

To address this error you need to update ChromeDriver and versions accordingly following the discussion in Timed out receiving message from renderer: 0.100 log messages using ChromeDriver and Chrome v80 through Selenium Java

于 2020-08-05T12:06:22.307 回答