英文:
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);
参考资料
您可以在以下链接中找到一些相关详细讨论:
- Chrome driver 的页面加载策略(更新至 Selenium v3.12.0)
- 如何使 Selenium 不等待完全加载页面,而该页面具有较慢的脚本?
- 在 Python 中使用 Selenium 不等待页面加载
渲染器超时收到消息
要解决此错误,您需要根据 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:
- Page load strategy for Chrome driver (Updated till Selenium v3.12.0)
- How to make Selenium not wait till full page load, which has a slow script?
- Don't wait for a page to load using Selenium in Python
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论