从渲染器接收消息时超时:600.000 当我们使用 Jenkins windows 服务模式执行 selenium 脚本时
Getting Timed out receiving message from renderer: 600.000 When we execute selenium scripts using Jenkins windows service mode
我们每天都在使用 jenkins window 服务(无头模式)执行我们的 selenium 自动化脚本。直到昨天它都运行良好。突然它停止工作并且没有启动浏览器。它显示以下错误消息 [1553677874.187][严重]:从渲染器接收消息超时:600.000。之后所有剩余的测试用例都失败了。
如果我们 运行 使用没有 windows 服务的 jenkins 构建,它工作正常。我们仅在 windows 作为服务
时遇到此问题
- 我的chrome驱动版本:73.0.3683.68
- Chrome浏览器版本:73.0.3683.68
- 硒版本:3.14.0
我试过降级浏览器版本和驱动版本。即使它不起作用
当我们使用 jenkins 作为 windows 服务执行但收到错误消息时,我希望浏览器应该在后台启动。
System.setProperty("webdriver.chrome.driver", "C:\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("load-extension=C:\1.13.4_0");
options.addArguments("--start-maximized");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--disable-popup-blocking");
// options.addArguments("window-size=1400,600");
options.addArguments("enable-automation");
options.addArguments("--headless");
options.addArguments("--window-size=1920,1080");
options.addArguments("--no-sandbox");
// options.addArguments("--disable-extensions");
options.addArguments("--dns-prefetch-disable");
options.addArguments("--disable-gpu");
options.setPageLoadStrategy(PageLoadStrategy.NORMAL);
DesiredCapabilities capabilities =
DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY,
**strong text**options);
return new ChromeDriver(capabilities);
可能的问题是您的 Google Chrome 已更新并与您的 Chrome 驱动程序不兼容。我建议获取新的 Chrome 驱动程序或将 Google Chrome 降级到以前的版本并禁用自动更新。
您可以在此处验证 Google Chrome 所需的 Chrome 驱动程序版本:
http://chromedriver.chromium.org/downloads
以下 link 的第 4 步对我有用,可以禁用自动 google Chrome 更新。
https://www.webnots.com/7-ways-to-disable-automatic-chrome-update-in-windows-and-mac/
您似乎正在使用以下配置:
- chromedriver=73.0.3683.68
- chrome=73.0.3683.68
- Windows OS
John Chen(所有者 - chromedriver)最近证实,
We have confirmed issues with take screenshot when Chrome 73.0.3686.75 is started by a service (such as Jenkins or Task scheduler) on Windows. Please see https://crbug.com/942023 for more details. We apologize for any inconvenience caused by this. However, we haven't yet been able to observe similar issue on Linux, so we appreciate any help you can provide to enable us to reproduce the issue on Linux. We don't have access to TeamCity, but we have tested take screenshot using Docker image produced by Selenium (selenium/standalone-chrome:3.141.59-lithium), and didn't find any problems.
昨天(2019年3月26日),约翰再次确认:
I am aware of some issues with running Chrome 73 from Jenkins. I don't know any workarounds. Please following https://crbug.com/942023 for updates.
更新
我们能够挖掘出主要问题。主要问题不在于 ChromeDriver v73.x 而在于 Chrome v73.x 并且 John 正式确认为:
The root cause is indeed in Chrome 73.x, not in ChromeDriver. We are working with Chrome devs to find a solution.
解决方案
快速解决方案是:
- 将 Chrome 浏览器 降级为 Chrome v72.x
- 使用匹配的ChromeDriver:
Note: If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69
- 确保 JDK 升级到 JDK 8u202 的最新级别。
结尾
您可以在以下位置找到相关讨论:
- Page.captureScreenshot no longer works in Chrome 73 under Selenium as a Service on Windows
- Error [SEVERE]: Timed out receiving message from renderer: 20.000 while executing the testsuite through Selenium on Jenkins
- Download Google Chrome 72 Offline Installer For All Operating Systems
更新(2019 年 4 月 3 日)
通过 ChromeOptions()
的实例添加参数 --disable-features=VizDisplayCompositor
似乎解决了问题:
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-features=VizDisplayCompositor");
WebDriver driver = new ChromeDriver(options);
driver.get("https://google.com");
在 ChromeDriver 初始化之前添加以下 属性(1)
- System.setProperty("webdriver.chrome.silentOutput", "true");
驱动程序 = 新的 ChromeDriver();
我们每天都在使用 jenkins window 服务(无头模式)执行我们的 selenium 自动化脚本。直到昨天它都运行良好。突然它停止工作并且没有启动浏览器。它显示以下错误消息 [1553677874.187][严重]:从渲染器接收消息超时:600.000。之后所有剩余的测试用例都失败了。
如果我们 运行 使用没有 windows 服务的 jenkins 构建,它工作正常。我们仅在 windows 作为服务
时遇到此问题- 我的chrome驱动版本:73.0.3683.68
- Chrome浏览器版本:73.0.3683.68
- 硒版本:3.14.0
我试过降级浏览器版本和驱动版本。即使它不起作用
当我们使用 jenkins 作为 windows 服务执行但收到错误消息时,我希望浏览器应该在后台启动。
System.setProperty("webdriver.chrome.driver", "C:\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("load-extension=C:\1.13.4_0");
options.addArguments("--start-maximized");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--disable-popup-blocking");
// options.addArguments("window-size=1400,600");
options.addArguments("enable-automation");
options.addArguments("--headless");
options.addArguments("--window-size=1920,1080");
options.addArguments("--no-sandbox");
// options.addArguments("--disable-extensions");
options.addArguments("--dns-prefetch-disable");
options.addArguments("--disable-gpu");
options.setPageLoadStrategy(PageLoadStrategy.NORMAL);
DesiredCapabilities capabilities =
DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY,
**strong text**options);
return new ChromeDriver(capabilities);
可能的问题是您的 Google Chrome 已更新并与您的 Chrome 驱动程序不兼容。我建议获取新的 Chrome 驱动程序或将 Google Chrome 降级到以前的版本并禁用自动更新。
您可以在此处验证 Google Chrome 所需的 Chrome 驱动程序版本: http://chromedriver.chromium.org/downloads
以下 link 的第 4 步对我有用,可以禁用自动 google Chrome 更新。 https://www.webnots.com/7-ways-to-disable-automatic-chrome-update-in-windows-and-mac/
您似乎正在使用以下配置:
- chromedriver=73.0.3683.68
- chrome=73.0.3683.68
- Windows OS
John Chen(所有者 - chromedriver)最近证实,
We have confirmed issues with take screenshot when Chrome 73.0.3686.75 is started by a service (such as Jenkins or Task scheduler) on Windows. Please see https://crbug.com/942023 for more details. We apologize for any inconvenience caused by this. However, we haven't yet been able to observe similar issue on Linux, so we appreciate any help you can provide to enable us to reproduce the issue on Linux. We don't have access to TeamCity, but we have tested take screenshot using Docker image produced by Selenium (selenium/standalone-chrome:3.141.59-lithium), and didn't find any problems.
昨天(2019年3月26日),约翰再次确认:
I am aware of some issues with running Chrome 73 from Jenkins. I don't know any workarounds. Please following https://crbug.com/942023 for updates.
更新
我们能够挖掘出主要问题。主要问题不在于 ChromeDriver v73.x 而在于 Chrome v73.x 并且 John 正式确认为:
The root cause is indeed in Chrome 73.x, not in ChromeDriver. We are working with Chrome devs to find a solution.
解决方案
快速解决方案是:
- 将 Chrome 浏览器 降级为 Chrome v72.x
- 使用匹配的ChromeDriver:
Note: If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69
- 确保 JDK 升级到 JDK 8u202 的最新级别。
结尾
您可以在以下位置找到相关讨论:
- Page.captureScreenshot no longer works in Chrome 73 under Selenium as a Service on Windows
- Error [SEVERE]: Timed out receiving message from renderer: 20.000 while executing the testsuite through Selenium on Jenkins
- Download Google Chrome 72 Offline Installer For All Operating Systems
更新(2019 年 4 月 3 日)
通过 ChromeOptions()
的实例添加参数 --disable-features=VizDisplayCompositor
似乎解决了问题:
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-features=VizDisplayCompositor");
WebDriver driver = new ChromeDriver(options);
driver.get("https://google.com");
在 ChromeDriver 初始化之前添加以下 属性(1)
- System.setProperty("webdriver.chrome.silentOutput", "true");
驱动程序 = 新的 ChromeDriver();