编辑:不是Jenkins特有的。我只是从命令行启动测试时遇到同样的错误。
我想在Jenkins中运行Protractor测试,使用存储在我项目中的特定Chromedriver。
这是我的配置文件:
exports.config = {
seleniumAddress: 'http://monsite:9095/wd/hub',
// Basically I put everything that sounds like Chrome.
chromeOnly: true,
// directConnect: true, // will uncomment it later...
chromeDriver: '../node_modules/chromedriver/bin/chromedriver',
capabilities: {
'browserName': 'chrome'
},
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 999999
},
specs: ['demo.js'],
baseUrl: 'http://monsite:3000'
};
在我的IDE中像魅力一样工作,但是当我从Jenkins Pipeline运行测试时,Jenkins尝试使用他自己的Chromedriver,即使我卸载了Chromedriver插件。
出现此错误消息:
[15:58:27] I/launcher - Running 1 instances of WebDriver
[15:58:27] I/hosted - Using the selenium server at http://monsite.ovh.net:9095/wd/hub
[15:59:27] E/launcher - unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.13.0-105-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.34 seconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'monsite.ovh.net', ip: '51.255.171.51', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-105-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
[15:59:27] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.13.0-105-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.34 seconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'monsite.ovh.net', ip: '51.255.171.51', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-105-generic', java.version: '1.8.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:505:15)
at parseHttpResponse (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:440:13)
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:777:24)
at Function.createSession (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/chrome.js:709:29)
at createDriver (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:167:33)
at Builder.build (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:623:16)
at Hosted.getNewDriver (/usr/lib/node_modules/protractor/lib/driverProviders/driverProvider.ts:60:29)
at Runner.createBrowser (/usr/lib/node_modules/protractor/lib/runner.ts:225:39)
at q.then.then (/usr/lib/node_modules/protractor/lib/runner.ts:391:27)
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)
[15:59:27] E/launcher - Process exited with error code 199
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 199
Finished: FAILURE
这发生在我跑步的阶段:
sh 'sudo protractor tests/src/conf-demo.js'
我已经更新了Jenkins Selenium Grid插件的配置,以匹配我在Protractor配置文件中设置的内容。
我在我的Protractor配置文件中尝试使用directConnect: true
,但我得到了完全相同的错误:
+ sudo protractor tests/src/conf-demo.js
[16:56:35] W/driverProviders - Using driver provider directConnect, but also found extra driver provider parameter(s): seleniumAddress
[16:56:35] I/launcher - Running 1 instances of WebDriver
[16:56:35] I/direct - Using ChromeDriver directly...
[16:56:36] E/launcher - Server terminated early with status 1
[16:56:36] E/launcher - Error: Server terminated early with status 1
at Error (native)
at earlyTermination.catch.e (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/remote/index.js:252:52)
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:777:24)
at Function.createSession (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/chrome.js:709:29)
at Direct.getNewDriver (/usr/lib/node_modules/protractor/lib/driverProviders/direct.ts:90:25)
at Runner.createBrowser (/usr/lib/node_modules/protractor/lib/runner.ts:225:39)
at q.then.then (/usr/lib/node_modules/protractor/lib/runner.ts:391:27)
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)
[16:56:36] E/launcher - Process exited with error code 199
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 199
Finished: FAILURE
工具版本......
[11:13:44] I/status - selenium standalone version available: 3.4.0 [last]
[11:13:44] I/status - chromedriver version available: 2.24 [last]
[11:13:44] I/status - geckodriver version available: v0.16.1 [last]
[11:13:44] I/status - android-sdk is not present
[11:13:44] I/status - appium is not present
我的谷歌浏览器版本为55,将其升级为58,行为相同。
我错过了什么青蛙?帮助将无可非议。
答案 0 :(得分:0)
我在我的Protractor配置文件中添加了一些解决问题的东西:
capabilities: {
'browserName': 'chrome',
// NEW
'chromeOptions': {
args: ["--headless", 'no-sandbox', "--disable-gpu", "--window-size=800x600"]
}
},
测试启动。他们得到另一个错误(他们不插入Xvfb)。但这个是another story ......