gpt4 book ai didi

java - 未知错误: cannot determine loading status from disconnected: Unable to receive message from renderer error with Selenium Java scripts on jenkins

转载 作者:行者123 更新时间:2023-12-01 19:56:00 27 4
gpt4 key购买 nike

我正在学习如何使用ma​​ven本地在jenkins服务器上创建和运行java selenium脚本的教程> eclipse

我的脚本非常基本,当通过 Maven 和 TestNG 在 Eclipse 中运行时,在本地运行良好。当我在 Jenkins 上运行它们时,构建需要 3 分钟到 15 分钟,然后通常会因超时渲染问题而失败。

我的脚本在本地运行最多只需要大约 2 分钟。

以前有人遇到过这个问题吗?我不确定为什么他们超时。

来自 Jenkins 的错误

unknown error: cannot determine loading status from disconnected: Unable to receive message from renderer   (Session info: chrome=78.0.3904.108)   (Driver info: chromedriver=78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}),platform=Mac OS X 10.13.6 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 7.77 seconds Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26' System info: host: 'Eamons-MBP.hitronhub.home', ip: '192.168.0.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_101' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{mobileEmulationEnabled=false, timeouts={implicit=0, pageLoad=300000, script=30000}, hasTouchScreen=false, platform=MAC, acceptSslCerts=false, goog:chromeOptions={debuggerAddress=localhost:60317}, acceptInsecureCerts=false, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=ignore, applicationCacheEnabled=false, rotatable=false, networkConnectionEnabled=false, chrome={chromedriverVersion=78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}), userDataDir=/var/folders/q3/3hrl35417q113_mhrglxf5cw00008b/T/.com.google.Chrome.Opshna}, takesHeapSnapshot=true, pageLoadStrategy=normal, strictFileInteractability=false, databaseEnabled=false, handlesAlerts=true, version=78.0.3904.108, browserConnectionEnabled=false, proxy={}, nativeEvents=true, locationContextEnabled=true, cssSelectorsEnabled=true}] Session ID: 7261e3005842ddc3d850504ba249d136
Stacktrace
org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status
from disconnected: Unable to receive message from renderer
(Session info: chrome=78.0.3904.108)
(Driver info: chromedriver=78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}),platform=Mac OS X 10.13.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7.77 seconds
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'Eamons-MBP.hitronhub.home', ip: '192.168.0.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_101'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{mobileEmulationEnabled=false, timeouts={implicit=0, pageLoad=300000, script=30000}, hasTouchScreen=false, platform=MAC, acceptSslCerts=false, goog:chromeOptions={debuggerAddress=localhost:60317}, acceptInsecureCerts=false, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=ignore, applicationCacheEnabled=false, rotatable=false, networkConnectionEnabled=false, chrome={chromedriverVersion=78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}), userDataDir=/var/folders/q3/3hrl35417q113_mhrglxf5cw00008b/T/.com.google.Chrome.Opshna}, takesHeapSnapshot=true, pageLoadStrategy=normal, strictFileInteractability=false, databaseEnabled=false, handlesAlerts=true, version=78.0.3904.108, browserConnectionEnabled=false, proxy={}, nativeEvents=true, locationContextEnabled=true, cssSelectorsEnabled=true}]
Session ID: 7261e3005842ddc3d850504ba249d136
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:304)
at Eamon.EamonTest.doSomething(EamonTest.java:37)
Standard Error
Starting ChromeDriver 78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}) on port 40247
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1574697681.040][WARNING]: Timed out connecting to Chrome, retrying...
[1574697692.398][SEVERE]: Unable to receive message from renderer

我的脚本

   @Test
public class NewTest {

@Test
public void doSomething() {

System.setProperty("webdriver.chrome.driver","/Users/Eamon/Desktop/chromedriver");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();

JavascriptExecutor js = (JavascriptExecutor) driver;


String baseUrl = "http://www.nfl.com/probowl/ballot";
//"http://www.nfl.com/probowl/ballot";
driver.get(baseUrl);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

WebElement html = driver.findElement(By.tagName("html"));
html.sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD));
html.sendKeys(Keys.chord(Keys.CONTROL, "25"));

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

js.executeScript("window.scrollBy(0,500)");
driver.findElement(By.id("1015811_13_1_10")).click();

js.executeScript("window.scrollBy(0,1000)");
driver.findElement(By.id("ballot-submit")).click();

driver.close();
driver.quit();
}

}

最佳答案

此错误消息...

unknown error: cannot determine loading status from disconnected: Unable to receive message from renderer   (Session info: chrome=78.0.3904.108)   (Driver info: chromedriver=78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}),platform=Mac OS X 10.13.6 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 7.77 seconds Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26' System info: host: 'Eamons-MBP.hitronhub.home', ip: '192.168.0.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_101' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{mobileEmulationEnabled=false, timeouts={implicit=0, pageLoad=300000, script=30000}, hasTouchScreen=false, platform=MAC, acceptSslCerts=false, goog:chromeOptions={debuggerAddress=localhost:60317}, acceptInsecureCerts=false, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=ignore, applicationCacheEnabled=false, rotatable=false, networkConnectionEnabled=false, chrome={chromedriverVersion=78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}), userDataDir=/var/folders/q3/3hrl35417q113_mhrglxf5cw00008b/T/.com.google.Chrome.Opshna}, takesHeapSnapshot=true, pageLoadStrategy=normal, strictFileInteractability=false, databaseEnabled=false, handlesAlerts=true, version=78.0.3904.108, browserConnectionEnabled=false, proxy={}, nativeEvents=true, locationContextEnabled=true, cssSelectorsEnabled=true}] Session ID: 7261e3005842ddc3d850504ba249d136
Stacktrace
org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status
from disconnected: Unable to receive message from renderer
(Session info: chrome=78.0.3904.108)
(Driver info: chromedriver=78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}),platform=Mac OS X 10.13.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7.77 seconds
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'Eamons-MBP.hitronhub.home', ip: '192.168.0.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_101'
Driver info: org.openqa.selenium.chrome.ChromeDriver
.
Standard Error
Starting ChromeDriver 78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}) on port 40247
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1574697681.040][WARNING]: Timed out connecting to Chrome, retrying...
[1574697692.398][SEVERE]: Unable to receive message from renderer

...意味着 ChromeDriver 无法启动/生成新的 WebBrowser,即 Chrome 浏览器 session 。

您的主要问题是您使用的二进制文件版本之间不兼容,如下所示:

  • 您正在使用chromedriver=78.0.3904.105
  • 您正在使用chrome=78.0.3904.108
  • 您的Selenium 客户端版本是2015-02-27 09:10:262.45.0,这是古老的 几乎年长5岁。
  • 您的JDK版本1.8.0_101,这是相当古老的。

因此,JDK v8u101Selenium Client v2.45.0ChromeDriver v78.0 之间存在明显不匹配Chrome 浏览器 v78.0

<小时/>

解决方案

确保:

  • JDK 已升级到当前级别 JDK 8u222 .
  • Selenium 升级至当前级别 Version 3.141.59 .
  • 通过IDE清理您的项目工作区,并仅使用所需的依赖项重建项目。
  • 如果您的基本网络客户端版本太旧,请通过 Revo Uninstaller 卸载它并安装最新的 GA 和已发布版本的Web 客户端
  • 重新启动系统
  • 非root用户身份执行@Test

关于java - 未知错误: cannot determine loading status from disconnected: Unable to receive message from renderer error with Selenium Java scripts on jenkins,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59042521/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com