从渲染器接收消息超时:10.000。

5

在运行场景时,我遇到了以下错误。

org.openqa.selenium.TimeoutException: timeout: Timed out receiving message from renderer: 10.000

(会话信息:chrome=79.0.3945.79) 构建信息:版本:'3.14.0',修订版:'aacccce0',时间:'2018-08-02T20:19:58.91Z' 系统信息: 主机:'fv-az598',ip:'10.1.0.4',os.name:'Linux',os.arch:'amd64', os.version:'4.15.0-1064-azure',java.version:'1.8.0_212' 驱动程序信息:org.openqa.selenium.remote.RemoteWebDriver Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.79, chrome: {chromedriverVersion: 79.0.3945.36

如你所见,粗体、突出显示的字体表明,我的Chrome和Chrome驱动程序版本匹配。

我还向我的ChromeOptions传递了一些参数,这可以帮助处理超时问题。

        // options to prevent TIMEOUTS
        options.addArguments("start-maximized"); //https://dev59.com/el8e5IYBdhLWcg3wS465#26283818
        options.addArguments("enable-automation"); //https://dev59.com/el8e5IYBdhLWcg3wS465#43840128
        options.addArguments("--no-sandbox"); //https://dev59.com/XFUL5IYBdhLWcg3wOl9x#50725918
        options.addArguments("--disable-infobars"); //https://dev59.com/el8e5IYBdhLWcg3wS465#43840128
        options.addArguments("--disable-dev-shm-usage"); //https://dev59.com/XFUL5IYBdhLWcg3wOl9x#50725918
        options.addArguments("--disable-browser-side-navigation"); //https://dev59.com/z1YM5IYBdhLWcg3wvB_-#49123152
        options.addArguments("--disable-gpu"); //https://stackoverflow.com/questions/51959986/how-to-solve-selenium-chromedriver-timed-out-receiving-message-from-renderer-exc
        options.addArguments("--disable-features=VizDisplayCompositor"); //https://dev59.com/4bLma4cB1Zd3GeqPg9IG

编辑:这个问题发生在DOCKER容器中运行时(使用chrome浏览器和node-chrome-debug的最新docker镜像)

如有任何想法,将不胜感激。


你能提供更多细节吗?因为可能是网络连接问题,你也可以尝试使用线程休眠。 - Alejandro Gonzalez
@Matthewek,你能否将你的Chrome浏览器升级到当前版本 ...Version 79.0.3945.88 (Official Build)... 吗? - undetected Selenium
@DebanjanB - 对不起,我之前没有提到(现在已编辑了帖子),这是在我运行它们的 Docker 中发生的,使用所有服务的 LATEST 图像(浏览器和 Chrome 驱动程序),因此我正在使用最新的可用 Docker 图像。谢谢。 - Matthewek
2个回答

3

This error message...

org.openqa.selenium.TimeoutException: timeout: Timed out receiving message from renderer: 10.000

这表示ChromeDriver无法启动/生成新的Browsing Context,即Chrome浏览器会话。

您面临的主要问题是以下二进制文件版本之间的不兼容性

  • 您正在使用的Selenium客户端版本为2018-08-02T20:19:58.91Z3.14.0,已经过1.5年的时间,而同时使用的ChromeDriver符合OSS规范。
  • 您正在使用chromedriver=79.0
  • 您正在使用chrome=79.0
  • 虽然chromedriver=79.0chrome=79.0是并发的,但它们与Selenium客户端版本3.14.0不兼容。

因此,在Selenium客户端v3.14.0ChromeDriver v79.0 Chrome浏览器v79.0 之间存在明显的不匹配。


解决方案

请确保:

  • JDK已升级到当前版本JDK 8u222
  • Selenium已升级到当前版本Version 3.141.59
  • 通过您的IDE清理项目工作空间,并仅使用所需的依赖项重建项目。

tl; dr

以下是一些相关讨论:


1
感谢您提供详细的答案,我的Selenium版本确实过时了,这是一个因素,将Selenium更新到3.141.59版本起初并没有帮助,但是结合传递的其他ChromeOptions(--disable-features=NetworkService, --dns-prefetch-disable, --disable-extensions),现在一切都很好,谢谢! - Matthewek

-1

这是因为你将页面加载超时设置为10秒,例如。

driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);

将这里的10更改为任何其他数字,以查看超时时间的增加

或者

如果不需要,请删除该行


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接