使用chromedriver 2.20和selenium server 2.48.2,测试失败,“Chrome启动失败:异常退出”

时间:2022-07-03 18:35:23

I am trying to run headless chrome tests on Ubuntu 14.04.3 using Selenium grid that sits on AWS EC2 server but cannot successfully run any test. I have been looking around for answers, tried many solutions/suggestions, but still failed. The closest answer I can get is that the chromedriver and selenium server versions were out of sync that's why I am getting this kind of error.

我正在尝试在Ubuntu 14.04.3上运行无头的chrome测试,它使用的是AWS EC2服务器上的Selenium grid,但无法成功运行任何测试。我一直在寻找答案,尝试了许多解决方案/建议,但仍然失败了。我能得到的最接近的答案是,chromedriver和selenium服务器版本不同步,这就是我为什么会出现这种错误的原因。

Can anyone please suggest latest chromedriver and selenium server versions that can work together successfully? Or can you please help suggest on how I can resolve below error? PS. I am quite new to this stuff and it was 48 years ago when I last used Linux. Any help will be much, much, much appreciated. Thank you very much!

有没有人可以建议最新的chromedriver和selenium服务器版本能够成功地合作?或者你能帮忙建议一下我如何解决下面的错误吗?PS,我对这个很陌生,48年前,我最后一次使用Linux。任何帮助都将是非常、非常、非常感谢的。非常感谢!

Ubuntu: 14.04.3
Java: 1.7.0_80
Selenium: selenium-server-standalone-2.48.2.jar
chromedriver: 2.20.353124

This was the command I run to register the webdriver to the hub:

这是我用来将webdriver注册到hub的命令:

root@ip:~# java -jar selenium-server-standalone-2.48.2.jar -Dwebdriver.chrome.driver='/usr/local/bin/chromedriver' -role webdriver -hub http://172.31.40.186:4444/grid/register -port 5555 -browser browserName=chrome,maxInstances=5,platform=LINUX --verbose --log-path='/usr/local/bin/chromedriver.log' &

Error log:

错误日志:

testTemp1(demo.test)  Time elapsed: 63.984 sec  <<< FAILURE!
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 3.13.0-48-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.68 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ip-172-31-40-186', ip: '172.31.40.186', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-48-generic', java.version: '1.7.0_80'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command duration or timeout: 62.19 seconds
Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06'
System info: host: 'ip-172-31-40-186', ip: '172.31.40.186', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-48-generic', java.version: '1.7.0_80'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:156)
    at demo.test.testTemp1(test.java:76)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 3.13.0-48-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.68 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'ip-172-31-40-186', ip: '172.31.40.186', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-48-generic', java.version: '1.7.0_80'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06'
System info: host: 'ip-172-31-40-186', ip: '172.31.40.186', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-48-generic', java.version: '1.7.0_80'
Driver info: driver.version: ChromeDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)
    at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

1 个解决方案

#1


0  

Thanks @makeMonday. The link you provided me didn't help me that much, but thanks anyway. I realized I may have had my linux environment all messed up. What I did was update my versions to below in order for my test to get running successfully.

谢谢@makeMonday。你提供给我的链接对我没有多大帮助,但还是要谢谢你。我意识到我的linux环境可能一团糟。我所做的是更新我的版本,以便我的测试成功运行。

Versions

版本

ubuntu=14.04
google-chrome=46.0.2490.86
chromedriver=2.20.353124
selenium server=2.47.1 or 2.48.2 (though sometimes, I am still getting a "session deleted because of page crash" error)

Then, I run below before running the test.

然后,在运行测试之前运行如下。

export DISPLAY=:0
Xvfb :0 -ac -screen 0 1024x768x24 &
google-chrome --remote-debugging-port=9222 &
nohup java -jar ./selenium-server-standalone-2.47.1.jar &
java -jar ./selenium-server-standalone-2.47.1.jar -role node -hub http://<IP>:4444/grid/register -port 5555

#1


0  

Thanks @makeMonday. The link you provided me didn't help me that much, but thanks anyway. I realized I may have had my linux environment all messed up. What I did was update my versions to below in order for my test to get running successfully.

谢谢@makeMonday。你提供给我的链接对我没有多大帮助,但还是要谢谢你。我意识到我的linux环境可能一团糟。我所做的是更新我的版本,以便我的测试成功运行。

Versions

版本

ubuntu=14.04
google-chrome=46.0.2490.86
chromedriver=2.20.353124
selenium server=2.47.1 or 2.48.2 (though sometimes, I am still getting a "session deleted because of page crash" error)

Then, I run below before running the test.

然后,在运行测试之前运行如下。

export DISPLAY=:0
Xvfb :0 -ac -screen 0 1024x768x24 &
google-chrome --remote-debugging-port=9222 &
nohup java -jar ./selenium-server-standalone-2.47.1.jar &
java -jar ./selenium-server-standalone-2.47.1.jar -role node -hub http://<IP>:4444/grid/register -port 5555