When running selenium test from jenkins, I get this error:
从jenkins运行selenium测试时,我收到此错误:
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.8.undefined,platform=Linux 3.13-1-686-pae x86) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 20.54 seconds Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358', time: '2013-05-22 12:00:17' System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.13-1-686-pae', java.version: '1.6.0_45' Driver info: org.openqa.selenium.chrome.ChromeDriver
and further in the stack trace:
并进一步在堆栈跟踪中:
DEBUG - Sending request: POST /session HTTP/1.1
DEBUG - >> "POST /session HTTP/1.1[\r][\n]"
DEBUG - >> "Accept: application/json, image/png[\r][\n]"
DEBUG - >> "Content-Type: application/json; charset=utf-8[\r][\n]"
DEBUG - >> "Content-Length: 143[\r][\n]"
DEBUG - >> "Host: localhost:30992[\r][\n]"
DEBUG - >> "Connection: Keep-Alive[\r][\n]"
DEBUG - >> "[\r][\n]"
DEBUG - >> POST /session HTTP/1.1
DEBUG - >> Accept: application/json, image/png
DEBUG - >> Content-Type: application/json; charset=utf-8
DEBUG - >> Content-Length: 143
DEBUG - >> Host: localhost:30992
DEBUG - >> Connection: Keep-Alive
DEBUG - >> "{"desiredCapabilities":{"platform":"ANY","browserName":"chrome","chromeOptions":{"args":[],"extensions":[]},"version":"","chrome.switches":[]}}"
DEBUG - << "HTTP/1.1 200 OK[\r][\n]"
DEBUG - << "Content-Length:218[\r][\n]"
DEBUG - << "Content-Type:application/json; charset=utf-8[\r][\n]"
DEBUG - << "Connection:close[\r][\n]"
DEBUG - << "[\r][\n]"
DEBUG - Receiving response: HTTP/1.1 200 OK
DEBUG - << HTTP/1.1 200 OK
DEBUG - << Content-Length:218
DEBUG - << Content-Type:application/json; charset=utf-8
DEBUG - << Connection:close
DEBUG - << "{"sessionId":"a272d037ff7f0bff2cfb2a49e052c02a","status":13,"value":{"message":"unknown error: Chrome failed to start: exited abnormally\n (Driver info: chromedriver=2.8.undefined,platform=Linux 3.13-1-686-pae x86)"}}"
DEBUG - Connection shut down
I am not using selenium grid.
我没有使用硒网格。
The strange thing is that I am able to launch chrome when sending commands to chromedriver directly as in the following command:
奇怪的是,我可以直接向chromedriver发送命令时启动chrome,如下面的命令所示:
curl -X POST -H "Content-Type: application/json; charset=utf-8" -d "{\"desiredCapabilities\":{\"platform\":\"ANY\",\"browserName\":\"chrome\",\"chromeOptions\":{\"args\":[],\"extensions\":[]},\"version\":\"\",\"chrome.switches\":[]}}" localhost:9515/session
A Chromimum window opens here.
Chromimum窗口在这里打开。
I am using Debian jessie (testing) with chromimum and chromedriver installed with aptitude. This is to get homogeneous versions.
我正在使用Debian jessie(测试)与chromimum和chromedriver安装aptitude。这是为了获得同类版本。
$ google-chrome -version Chromium 33.0.1750.152 Debian jessie/sid
./chromedriver -v Starting ChromeDriver (v2.8.undefined) on port 9515
I have also created an other issue with a previous version of Debian, you could read to know more what I tried before. unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9
我还使用以前版本的Debian创建了另一个问题,您可以阅读以了解我之前尝试过的更多内容。未知错误:Chrome无法启动:异常退出(驱动程序信息:chromedriver = 2.9
1 个解决方案
#1
0
At least on a linux machine, I think chrome needs an X11 display in order to start up. You can provide that as a regular display (when you run it as a normal user on a desktop environment), as a connection through a network to a normal remote or local display (e.g. through vnc server) or through a virtual apparatus like X virtual framebuffer.
至少在linux机器上,我认为chrome需要一个X11显示才能启动。您可以将其作为常规显示(在桌面环境中以普通用户身份运行时),通过网络连接到普通远程或本地显示器(例如通过vnc服务器)或通过虚拟设备(如X虚拟设备)帧缓冲区。
For your purposes (testing) I'd say that Xvfb is probably the best option. See here for an example using it for testing.
为了您的目的(测试)我会说Xvfb可能是最好的选择。请参阅此处以获取使用它进行测试的示例。
#1
0
At least on a linux machine, I think chrome needs an X11 display in order to start up. You can provide that as a regular display (when you run it as a normal user on a desktop environment), as a connection through a network to a normal remote or local display (e.g. through vnc server) or through a virtual apparatus like X virtual framebuffer.
至少在linux机器上,我认为chrome需要一个X11显示才能启动。您可以将其作为常规显示(在桌面环境中以普通用户身份运行时),通过网络连接到普通远程或本地显示器(例如通过vnc服务器)或通过虚拟设备(如X虚拟设备)帧缓冲区。
For your purposes (testing) I'd say that Xvfb is probably the best option. See here for an example using it for testing.
为了您的目的(测试)我会说Xvfb可能是最好的选择。请参阅此处以获取使用它进行测试的示例。