我已经搜索并尝试了近一周的不同解决方案,但仍未找到答案。
首先,我的环境: Server Debian 8(无GUI),Protractor 4.0.9,Selenium Server 2.53.1(使用webdriver-manager开始),Chromedriver 2.24.417424,Chrome 54.0.2840.100,Firefox 43.0,Xvfb
我尝试使用无头Chrome来执行测试,但Chrome无法启动。 请注意,我能够使用Firefox无头网完全运行我的测试。 这是我尝试使用Chrome运行测试时的输出:
[18:38:31] E/launcher - unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3),platform=Linux 3.16.0-4-amd64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.13 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'testing', ip: '10.128.0.5', os.name: 'Linux', os.arch: 'amd64', os.version: '3.16.0-4-amd64', java.version: '1.7.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
[18:38:31] E/launcher - WebDriverError: unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3),platform=Linux 3.16.0-4-amd64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.13 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'testing', ip: '10.128.0.5', os.name: 'Linux', os.arch: 'amd64', os.version: '3.16.0-4-amd64', java.version: '1.7.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at WebDriverError (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
at Object.checkLegacyResponse (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15)
at parseHttpResponse (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13)
at client_.send.then.response (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11)
at ManagedPromise.invokeCallback_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at asyncRun (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25)
at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
at Builder.build (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24)
at Hosted.DriverProvider.getNewDriver (/usr/lib/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
at Runner.createBrowser (/usr/lib/node_modules/protractor/built/runner.js:198:43)
at /usr/lib/node_modules/protractor/built/runner.js:277:30
at _fulfilled (/usr/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/lib/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/usr/lib/node_modules/protractor/node_modules/q/q.js:796:13)
at /usr/lib/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/usr/lib/node_modules/protractor/node_modules/q/q.js:137:13)
[18:38:31] E/launcher - Process exited with error code 199
总是一样的。 我可以正常使用Xvfb运行Chrome和Firefox,并且chromedriver在手动启动时运行良好。
这是我用来启动Xvfb的命令:
Xvfb -ac :99 -screen 0 1280x1024x16 &
export DISPLAY=:99
手动启动chromedriver时的输出:
Starting ChromeDriver 2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3) on port 9515
Only local connections are allowed.
希望你们能帮帮我。
答案 0 :(得分:0)
您需要使用命令xvbf-run protractor configuration.js