Selenium自动化页面加载速度非常慢。

huangapple go评论119阅读模式
英文:

Selenium automation Page Loading is very Slow

问题

我正在使用ChromeDriver进行Selenium自动化测试。但与手动测试相比,网页加载速度非常慢。请帮忙。

出现错误:

[1596549682.992][SEVERE]: 从渲染器接收消息超时: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

英文:

I am using chromedriver for selenium automation.But webpage loading is very slow compared to manual testing.Kindly help

Getting error:

[1596549682.992][SEVERE]: Timed out receiving message from renderer: 300.000

Code trials:

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 version:84
Chrome driver Version:84
Selenium version:Tried 3.141.59 and 3.5.2

答案1

得分: 2

Selenium 默认将 pageLoadStrategy 设置为 NORMAL。因此,明确设置相同的值不会有任何区别。

但是,为了避免等待加载缓慢的网页,您可以将能力 java.lang.String PAGE_LOAD_STRATEGY 设置为 none,如下所示:

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

参考资料

您可以在以下链接中找到一些相关详细讨论:


渲染器超时收到消息

要解决此错误,您需要根据 Timed out receiving message from renderer: 0.100 log messages using ChromeDriver and Chrome v80 through Selenium Java 中的讨论更新 ChromeDriver 和 [tag:google-chrome] 版本。

英文:

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 [tag:google-chrome] versions accordingly following the discussion in Timed out receiving message from renderer: 0.100 log messages using ChromeDriver and Chrome v80 through Selenium Java

huangapple
  • 本文由 发表于 2020年8月4日 22:47:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/63249385.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定