Chromedriver works manually but fails when ran from Jenkins Slave - linux

I have a Jenkins slave node setup with LinuxMint. So we can do some browser testing on a Linux box in Chrome and Firefox.
I have the latest Chromedriver installed where the test can run it and when I go into /var/jenkins/workspace/<project name>/TestAutomation/SeleniumFramework manually and do my run npm <test name> the tests launch the chromedriver and run successfully.
When I go into Jenkins and run my test chromedriver is failing with the following and I am not sure where to go with this.:
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/error.js:108
var template = new Error(this.message);
^
UnknownError: unknown error: Chrome failed to start: exited abnormally
(Driver info: 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)
at /var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:160:24
at promise.ControlFlow.runInFrame_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
at goog.defineClass.notify (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
at promise.Promise.notify_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
at Array.forEach (native)
at promise.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/selenium-webdriver/lib/webdriver/webdriver.js:157:22)
at Function.webdriver.WebDriver.createSession (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30)
at new Driver (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/chrome.js:810:36)
at DirectDriverProvider.getNewDriver (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/protractor/lib/driverProviders/direct.js:68:16)
at Runner.createBrowser (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/protractor/lib/runner.js:182:37)
at /var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/protractor/lib/runner.js:263:21
at _fulfilled (/var/jenkins/workspace/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)
at Promise.promise.promiseDispatch (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:759:13)
at /var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:525:49
[launcher] Process exited with error code 1

First Solution:
Have you java 8 installed? If yes, uninstall it and install java 7.
Second Solution:
Downgrade protractor to v1.8.0
~
More informations: https://github.com/angular/protractor/issues/1905
#edit
I found a similar topic as your, the same error in 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 &
link: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9

So I was connecting to the slaves from the Jenkins master via SSH. This wasn't ever going to launch a browser session. I switched over to the Java Web Start option, and it launched the browser just fine.

Related

Unable to start Selenium server due to error "UNABLE_TO_GET_ISSUER_CERT_LOCALLY"

I have uninstalled/reinstalled nodejs, protractor, selenium, webdriver-manager but error continues.
- What else should I uninstall or update?
- Can someone please provide next steps or some direction to correct issue?
- where do i get the local certificate?
my commands:
1. webdriver-manager update --ignore_ssl --proxy http://password#proxy.path.com:8080
2. webdriver-managerstart ---(error details below)
Current global installed versions:
protractor Version 5.4.3
webdriver-manager 12.1.7
selenium standalone version available: 3.141.59
chromedriver version available: 80.0.3987.106
geckodriver version available: v0.26.0
Error: unable to get local issuer certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1473:34)
at TLSSocket.emit (events.js:311:20)
at TLSSocket._finishInit (_tls_wrap.js:916:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:686:12) {
code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
}
[13:56:46] I/start - java -Dwebdriver.gecko.driver=C:\Users\USERNAME\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\geckodriver-v0.26.0.exe -jar C:\Users\USERNAME\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.141.59.jar -port 4444
[13:56:46] I/start - seleniumProcess.pid: 2884
13:56:46.834 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
13:56:46.957 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-03-17 13:56:47.035:INFO::main: Logging initialized #513ms to org.seleniumhq.jetty9.util.log.StdErrLog
13:56:47.373 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
13:56:48.375 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
Can you run the webdriver-manager update --ignore_ssl from your local project node modules, probably your command is running globally, Try the below options , either one should work
Run ./node_modules/webdriver-manager update --ignore_ssl --proxy with proxy
Run ./node_modules/webdriver-manager update --ignore_ssl without proxy
"Run ./node_modules/webdriver-manager update --ignore_ssl --proxy with proxy"
I ran suggestion above but get this error message with business proxy:
I/http_utils - ignoring SSL certificate
E/downloader - Expected response code 200, received: 403
I/update - selenium standalone: file exists .AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.141.59.jar
I/update - selenium standalone: selenium-server-standalone-3.141.59.jar up to date
(node:72544) UnhandledPromiseRejectionWarning: Error: response status code is not 200

Server terminated early with status 2 error while running e2e tests on windows

I'm working on an angular 2 app and for that I've configured protractor for end-2-end testing. but when I try to run the test cases, I get the following error
[11:53:45] I/local - Starting selenium standalone server...
[11:53:45] I/launcher - Running 1 instances of WebDriver
[11:53:45] E/launcher - Server terminated early with status 2
[11:53:45] E/launcher - Error: Server terminated early with status 2
at Error (native)
at C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:242:20
at ManagedPromise.invokeCallback_ (C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at asyncRun (C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2775:27)
at C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:109:7)
[11:53:45] E/launcher - Process exited with error code 199
webdriver-manager version: 10.3.0
node version: 6.11.0
npm version: 3.8.6
protractor version: 4.0.9
Environment: Windows
I've searched the web but unable to find solution for the issue. Any help would be appreciated. Thanks

Protractor for NodeJS on a virtual machine - How do I fix error 199?

I'm trying to use Protractor on a virtual machine and am getting the error code 199.
I am following this tutorial with the exact same steps - http://www.protractortest.org/#/tutorial
When I enter protractor conf.js on the command line, I get the following error:
[14:51:31] I/hosted - Using the selenium server at (my url here)
[14:51:31] I/launcher - Running 1 instances of WebDriver
[14:51:51] E/launcher - null
[14:51:51] E/launcher - WebDriverError: null
at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15)
at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13)
at client_.send.then.response (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11)
at ManagedPromise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at asyncRun (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24)
at Hosted.DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:197:43)
at /usr/local/lib/node_modules/protractor/built/runner.js:276:30
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13)
at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:137:13)
[14:51:51] E/launcher - Process exited with error code 199
The problem is not connecting to the webdriver as I have exposed a port and able to access the url and view the hub for it.
Thanks.
After a lot of prodding, running strace, running manually etc I managed to get to the bottom of this on debian/devuan. If I ran chromium by hand it worked fine (Chrome would appear and I could browse). However every time I ran protractor there would a long hang followed by:
E/launcher - null
E/launcher - WebDriverError: null
strace of protractor was showing selenium was returning a 500 series error. Looking at ps uwww allowed me to see that the following command was being executed:
java -Dwebdriver.chrome.driver=.../webdriver-manager/selenium/chromedriver_2.26
-jar .../selenium-server-standalone-2.53.1.jar -port 60987
Running this manually, connecting to the instance, creating a new session and selecting chrome gave the error:
.../webdriver-manager/selenium/chromedriver_2.26: error while loading shared libraries:
libgconf-2.so.4: cannot open shared object file: No such file or directory
On installing libgconf2 with apt-get install libgconf-2-4 (on Devuan Jessie) this then fixed both the manually created selenium instance and the protractor test.

"Process finished with exit code 199" is populating when run the config file

I Executed the config file, browser invoked after that the below Error is appeared in console.
Tools Used Webstrom/Eclipse
Protractor Version :4.0.0
"C:\Program Files (x86)\JetBrains\WebStorm 2016.2.3\bin\runnerw.exe"
"C:\Program Files\nodejs\node.exe"
C:\Users\surya\AppData\Roaming\npm\node_modules\protractor\built\cli.js
C:\samplepro\conf.js
I/hosted - Using the selenium server at http://localhost:4444/wd/hub
I/launcher - Running 1 instances of WebDriver
E/launcher - "process.on('uncaughtException'" error, see launcher
E/launcher - Process exited with error code 199
Process finished with exit code 199
Protractor version 4.0.0 have one important bug with uncaughtException uncaughtException after a Protractor run
You should use protractor version >4.0.1
After upgrade the protractor version you should be able to see what is the problem

Chrome or Firefox fails to start on selenium node machine if the node is started from a shell script at the startup

I have a shell script to register the node machine to hub at startup.
The script contains:
java -jar ~/selenium/selenium-server.jar -role node -hub http://HUB_IP:4444/grid/register -browser browserName="firefox",maxInstances=5,Platform="LINUX",applicationName="VM_NAME" -browser browserName="chrome",maxInstances=5,Platform="LINUX",applicationName="VM_NAME" -Dwebdriver.chrome.driver=~/selenium/chromedriver
The script starts fine in the startup and even the node gets registered to hub, but, when I start a job from Jenkins its gives below error in case of Firefox:
FAILED CONFIGURATION: #BeforeClass setup
org.openqa.selenium.WebDriverException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
When I start a job from Jenkins its gives below error in case of Chrome:
FAILED CONFIGURATION: #BeforeClass setup
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 3.13.0-68-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Note:
1. Using later version of chrome, firefox & Selenium jar files
2. When the script is run manually, everything works fine.
3. Start up batch file in windows works fine without any problem.

Resources