未知错误:无法从断开连接确定加载状态:无法从渲染器接收消息,Jenkins 上的 Selenium Java 脚本出现错



我正在学习一个教程,介绍如何使用maveneclipse在本地和jenkins 服务器上创建和运行 javaselenium 脚本。

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

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

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

来自詹金斯的错误

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浏览器会话。

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

  • 您正在使用的 chromedriver=78.0.3904.105
  • 您正在使用的 chrome=78.0.3904.108
  • 您的Selenium客户端版本是2.45.0的2015-02-27 09:10:26,这是古老的,几乎5年的历史。
  • 您的JDK版本1.8.0_101,这是非常古老的。

所以JDK v8u101Selenium Client v2.45.0、ChromeDriver v78.0和Chrome浏览器v78.0之间存在明显的不匹配


溶液

确保:

  • JDK已升级到当前级别 JDK 8u222。
  • 已升级到当前级别 版本 3.141.59。
  • 通过IDE清理项目工作中心,并仅使用所需的依赖项重新生成项目。
  • 如果您的基本 Web 客户端版本太旧,请通过Revo 卸载程序将其卸载,并安装最新的 GA 和已发布版本的Web 客户端
  • 重新启动系统
  • 非 root用户身份执行@Test

相关内容

  • 没有找到相关文章

最新更新