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

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.

Related

Running Test in Docker using Chrome and Chromedriver in Python

I am trying to run some tests in Docker using chromedriver and chrome in Python.
chrome_options = Options()
chrome_options.add_argument('--headless')
However, I used the add_argument('--headless') I have a returning error : Engine not supported, Your version currently configured does not support this"
But, if I do not used the add_argument('--headless'), I received this error:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Any tip?

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.

Chromedriver works manually but fails when ran from Jenkins Slave

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.

protractor web-driver with selenium on linux

I have the following setup:
protractor running from a windows vm using a stand alone selenium server on a linux headless box.
The idea was to have chrome installed on my windows vm and to have protractor use this chrome install to run the tests via the selenium on the linux box. I start the selenium server on the linuxx box using webdriver-manager start.
When I run the tests from the VM I get the folloiwng error
Caused by: org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 2.6.32-431.29.2.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 134 milliseconds
Build info: version: '2.45.0',java.version: '1.7.0_79'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)
... 14 more
10:39:09.119 WARN - Exception: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 2.6.32-431.29.2.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 134 milliseconds
java.version: '1.7.0_79'
Driver info: org.openqa.selenium.chrome.ChromeDriver
In my protractor conf I it configured to use the selenium standalone server by specifying the selenium url.
Any ideas how to resolve this and get the browser to be opened on my windows vm rather than the linux box looking for the chrome binary.
Thanks

Running Grails 2.3.1 in debug mode from linux

I'm trying to run Grails 2.3.1 en debug mode either from console or IntelliJ IDEA 12, but I always get the following error:
grails run-app --debug-fork
| Running Grails application
ERROR: transport error 202: bind failed: Address already in use
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]
First of all I configure my IDEA Debug mode.
For grails <2.4
I'm doing next:
1. grails-debug run-app
It's opening port 5005 and waiting for your IDE to connect
2. Go to IDEA and hit "bug" button
3. Your grails console automatically runs application
For grails 2.4
1. "grails --debug run-app"
2. Hit "bug" button
I solved it as follows
i switched and reswitched the grails version with gvm default ...
i checked a fresh copy

Resources