Error while downloading geckodriver during webdriver-manager update from jenkins

Deadly 提交于 2020-01-16 11:42:27

问题


I am trying to run webdriver update from jenkins. I am downloading geckoDriver and chromeDriver. Chrome driver is downloading and unzipping properly. But gecko driver download is not working. However this is working fine from local. Issue occurs only in jenkins

Command used:

node_modules/protractor/bin/webdriver-manager update --ignore_ssl --proxy=http://proxy --versions.gecko=v0.25.0 --versions.chrome=78.0.3904.105

Firefox version in server: 60.9.0

Error:

[16:23:13] I/http_utils - ignoring SSL certificate
[16:23:13] I/config_source - curl -ok /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/chrome-response.xml 'http://proxy...' -H 'host:chromedriver.storage.googleapis.com'
[16:23:13] I/http_utils - ignoring SSL certificate
[16:23:13] I/config_source - curl -ok /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/gecko-response.json 'http://proxy.../repos/mozilla/geckodriver/releases' -H 'host:api.github.com'
[16:23:13] I/http_utils - ignoring SSL certificate
[16:23:14] I/downloader - curl -ok /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105.zip 'http://proxy.../78.0.3904.70/chromedriver_linux64.zip' -H 'host:chromedriver.storage.googleapis.com'
[16:23:14] I/update - chromedriver: unzipping chromedriver_78.0.3904.105.zip
[16:23:14] I/update - chromedriver: setting permissions to 0755 for /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105
[16:23:16] I/http_utils - ignoring SSL certificate
[16:23:17] E/downloader - tunneling socket could not be established, statusCode=403
[16:23:17] I/update - geckodriver: file exists /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.25.0.tar.gz
[16:23:17] I/update - geckodriver: unzipping geckodriver-v0.25.0.tar.gz
(node:42561) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, rename '/var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver' -> '/var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.25.0'
    at Object.renameSync (fs.js:598:3)
    at unzip (/var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/built/lib/cmds/update.js:240:8)
    at files_1.FileManager.downloadFile.then.downloaded (/var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/built/lib/cmds/update.js:205:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:42561) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:42561) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

When i manually downloaded the driver files and added inside node_modules/selenium location, webdriver-manager update is successful. But the tunneling socket error was still present. Logs below:

[16:30:00] I/http_utils - ignoring SSL certificate
[16:30:00] I/http_utils - ignoring SSL certificate
[16:30:00] I/http_utils - ignoring SSL certificate
[16:30:00] I/update - chromedriver: file exists /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105.zip
[16:30:00] I/update - chromedriver: unzipping chromedriver_78.0.3904.105.zip
[16:30:00] I/update - chromedriver: setting permissions to 0755 for /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105
[16:30:00] I/update - chromedriver: chromedriver_78.0.3904.105 up to date
[16:30:02] E/downloader - tunneling socket could not be established, statusCode=403
[16:30:02] I/update - geckodriver: file exists /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.25.0.tar.gz
[16:30:02] I/update - geckodriver: unzipping geckodriver-v0.25.0.tar.gz
[16:30:02] I/update - geckodriver: setting permissions to 0755 for /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.25.0
[16:30:02] I/update - geckodriver: geckodriver-v0.25.0 up to date

But ng e2e is failing with the below error:

[16:30:03] I/launcher - Running 1 instances of WebDriver

[16:30:03] I/direct - Using FirefoxDriver directly...
[16:30:03] E/launcher - spawn /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.25.0 EACCES
[16:30:03] E/launcher - Error: spawn /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.25.0 EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
[16:30:03] E/launcher - Process exited with error code 199
npm ERR! code ELIFECYCLE
npm ERR! errno 1

I am using directconnect=true in protractor conf.js

Can someone please check what i am doing wrong here?


回答1:


There are a few things that you can try here:

1) If your tests are running inside a container, you will have to disable the dev-shm usage by adding a "--disable-dev-shm-usage" flag in your capabilities. Or you can mount the dev/shm as a volume when you run your tests.

2) You can set Marionette to true in your browser capabilities for firefox.

3) Run the container as root so that it runs as a privilaged user

4) Run the tests using ./node_modules/protractor/bin/protractor protractor.conf.js instead of using ng e2e

5) Update the webdriver packages using ./node_modules/protractor/bin/webdriver-manager update --ignore_ssl --proxy=http://proxy --versions.gecko=v0.25.0 --versions.chrome=78.0.3904.105

6) Try adding these lines to your entrypoint for the docker image:

#!/bin/bash
uid=$(stat -c %u ${PWD})
gid=$(stat -c %g ${PWD})

groupadd -o -g $gid protractor
useradd -m -o -u $uid -g $gid protractor

sudo -u protractor npm run test

Still I cannot say if one of these steps would solve your problem.



来源:https://stackoverflow.com/questions/59527871/error-while-downloading-geckodriver-during-webdriver-manager-update-from-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!