首页 文章

Chromedriver手动工作但从Jenkins Slave运行时失败

提问于
浏览
1

我有一个使用LinuxMint的Jenkins从属节点设置 . 因此,我们可以在Chrome和Firefox的Linux机器上进行一些浏览器测试 .

我安装了最新的Chromedriver,测试可以运行它,当我手动进入 /var/jenkins/workspace/<project name>/TestAutomation/SeleniumFramework 并执行我的 run npm <test name> 测试启动chromedriver并成功运行 .

当我进入詹金斯并运行我的测试chromedriver失败了以下,我不知道该去哪里:

直接使用ChromeDriver ... [launcher]运行WebDriver的一个实例/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/error.js:108 var template =新错误(this.message); ^未知错误:未知错误:Chrome无法启动:异常退出(驱动程序信息:chromedriver = 2.21.371461(633e689b520b25f3e264a2ede6b74ccc23cb636a),platform = Linux 3.19.0-32-generic x86_64)at new bot.Error(/ var / jenkins / workspace) /QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/error.js:108:18)at Object.bot.response.checkResponse(/ var / jenkins / workspace / QA-E2E-Linux /TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/response.js:109:9)/ var / jenkins / workspace / QA-E2E-Linux / TestAutomation / SeleniumFramework / node_modules / selenium-webdriver / lib / webdriver /webdriver.js:160:24在promise.ControlFlow.runInFrame_(/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js :1857:20)goog.defineClass.notify(/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448: 25)在在Array.forEach中的promise.Promise.notify_(/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12) (native)在prom.Promise.notifyAll_(/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15) at goog.async.run.processWorkQueue(/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/async/run.js:130:15)at process.tickCallback (internal / process / next_tick.js:103:7)From:Task:WebDriver.createSession()at Function.webdriver.WebDriver.acquireSession(/ var / jenkins / workspace / QA-E2E-Linux / TestAutomation / SeleniumFramework / node_modules /函数.webdriver.WebDriver.createSession中的selenium-webdriver / lib / webdriver / webdriver.js:157:22)(/ var / jenkins / workspace / QA-E2E-Linux / TestAutomation / SeleniumFramework / node_modules / selenium-webdriver / lib /的webdriver / webdriver.js:131:3 0)在DirectDriverProvider.getNewDriver的新驱动程序(/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/chrome.js:810:36)(/ var / jenkins / workspace / QA -E2E-Linux / TestAutomation / SeleniumFramework / node_modules / protractor / lib / driverProviders / direct.js:68:16)在Runner.createBrowser(/ var / jenkins / workspace / QA-E2E-Linux / TestAutomation / SeleniumFramework / node_modules / protractor) /lib/runner.js:182:37)在/fulfilled //var/jenkins / / var / jenkins / work /自动化工作区/ QA-E2E-Linux / TestAutomation / SeleniumFramework / node_modules / q / q.js:797:54)at self.promiseDispatch.done(/ var / jenkins / workspace / QA-E2E-Linux / TestAutomation / SeleniumFramework / node_modules / q / q.js:826:30)在/ var /的Promise.promise.promiseDispatch(/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:759:13)詹金斯/工作区/ QA-E2E-Linux的/ TestAutomation / SeleniumFram ework / node_modules / q / q.js:525:49 [launcher]进程已退出,错误代码为1

2 回答

  • 2

    First Solution:

    你有java 8安装?如果是,请卸载它并安装java 7 .

    Second Solution:

    将量角器降级到v1.8.0

    更多信息:https://github.com/angular/protractor/issues/1905

    @编辑

    我发现了一个与你相似的话题,jenkins中的同样错误 - linux:

    In you jenkins settings add a global property
    
    key : DISPLAY
    value:0:0
    
    On your server start Xvfb in the background:
    
    Xvfb :0 -ac -screen 0 1024x768x24 &
    

    链接:unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9

  • 2

    所以我通过SSH连接到Jenkins大师的奴隶 . 这不会启动浏览器会话 . 我切换到了Java Web Start选项,它启动了浏览器就好了 .

相关问题