Unable to invoke Browser from Jenkins Job for Protractor Code (Note: Jenkins is set-up through Docker Image)

  docker, jenkins, protractor, webdriver

Mentioning the steps that I have followed and the problem that I am facing:

I have pulled jenkins image through below docker command

docker pull jenkins/jenkins:lts

Jenkins is up, Git integration also seems fine as it clones the git repo. The only folder which does not get cloned is webdriver-manager.

I have used below commands in the Jenkins Job ‘Execute Shell’ (Note I have tried both with g and without g)

npm install -g protractor
npm install -g chromedriver
webdriver-manager update
protractor conf.js

I get below message in the console

[08:31:26] I/update - chromedriver: unzipping chromedriver_88.0.4324.96.zip
[08:31:26] I/update - chromedriver: setting permissions to 0755 for /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_88.0.4324.96

which shows that it has extracted chormedriver in this folder "node_modules/protractor/node_modules" but when I go there in workspace it is not present.

I get below console error after execution

protractor conf.js
[08:31:29] I/launcher - Running 1 instances of WebDriver
[08:31:29] I/direct - Using ChromeDriver directly...
[08:31:29] E/runner - Unable to start a WebDriver session.
[08:31:29] E/launcher - Error: Error: Server terminated early with status 127
    at /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS/lib/node_modules/protractor/node_modules/selenium-webdriver/remote/index.js:252:52
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
[08:31:29] E/launcher - Process exited with error code 100
Build step 'Execute shell' marked build as failure

Problem statement Unable to invoke the browser so test execution gets failed.

Current Solutions that I have read – It suggests to run in headless mode, but I want to run it in browser where I can see the execution, I don’t want to run headless

Please help, thanks

Source: Docker Questions

LEAVE A COMMENT