Selenium驱动程序无法为使用Firefox的非root用户启动WebDriver会话

时间:2016-04-19 21:46:21

标签: selenium firefox selenium-webdriver protractor

我有一个GoCD(思想工作)代理,通过在Xvfb上使用Headless Firefox的grunt自动化任务,在专用服务器上运行selenium和量角器进行端到端测试。

如果我以root身份运行任务(请注意目录中的所有文件和文件夹都归GO用户所有),它运行正常。

如果我以Go用户(运行自动化测试的那个)运行任务,我会收到以下错误:

16:37:42.357 Running "protractor:ci" (protractor) task
16:37:42.573 Starting selenium standalone server...
16:37:42.581 [launcher] Running 1 instances of WebDriver
16:37:43.194 Selenium standalone server started at http://XX.XX.XX.54:48234/wd/hub
16:37:45.385 ERROR - Unable to start a WebDriver session.
16:37:45.393 
16:37:45.394 /var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113
16:37:45.394   var template = new Error(this.message);
16:37:45.394                  ^
16:37:45.394 UnknownError: Bad request
16:37:45.394 Command duration or timeout: 166 milliseconds
16:37:45.394 Build info: version: '2.47.0', revision: '0e4837e', time: '2015-07-29 22:56:05'
16:37:45.394 System info: host: 'MyHostNAME', ip: 'XX.XX.XX.54', os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.32-xxxx-grs-ipv6-64', java.version: '1.7.0_95'
16:37:45.394 Driver info: org.openqa.selenium.firefox.FirefoxDriver
16:37:45.394     at new bot.Error (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)
16:37:45.394     at Object.bot.response.checkResponse (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
16:37:45.394     at /var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:152:24
16:37:45.394     at /var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
16:37:45.394     at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
16:37:45.394     at notify (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
16:37:45.394     at notifyAll (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
16:37:45.394     at resolve (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
16:37:45.394     at fulfill (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
16:37:45.394     at /var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
16:37:45.394 ==== async task ====
16:37:45.394 WebDriver.createSession()
16:37:45.395     at Function.webdriver.WebDriver.acquireSession_ (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22)
16:37:45.395     at Function.webdriver.WebDriver.createSession (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30)
16:37:45.395     at Builder.build (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22)
16:37:45.395     at DriverProvider.getNewDriver (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
16:37:45.395     at Runner.createBrowser (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/lib/runner.js:180:37)
16:37:45.395     at /var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/lib/runner.js:257:21
16:37:45.395     at _fulfilled (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:797:54)
16:37:45.395     at self.promiseDispatch.done (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:826:30)
16:37:45.395     at Promise.promise.promiseDispatch (/var/lib/go-agent/pipelines/development/e2e_tests/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:759:13)
16:37:45.395 [launcher] Process exited with error code 1
16:37:45.397 >> 
16:37:45.397 Fatal error: protractor exited with code: 1
16:37:45.414 [go] Current job status: failed.

什么可能阻止GO用户启动服务器?

感谢您的任何反馈, 最好的问候,

拉​​法。

0 个答案:

没有答案