Selenium Grid with Protractor: SessionNotCreatedError at Object.checkLegacyResponse - selenium

I'm new to Selenium Grid and I'm trying to execute a protractor test on a remote node.
I'm using a Virtual Machine as Hub, the Node is my local machine which is also the client.
Both hub and node are up and running.
I've set the property seleniumAddress correctly in the conf.js file.
So now when I execute my test by running protractor conf.js, I'm getting this error:
E/launcher - SessionNotCreatedError: Unable to create new service:
ChromeDriverService
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-
08T15:15:08.936Z'
System info: host: 'host-name', ip: 'ip-address', os.name: 'Windows 7',
os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_171'
Driver info: driver.version: unknown
at Object.checkLegacyResponse
I have no idea why I'm getting this error. I tried to fix it by running:
webdriver-manager clean
webdriver-manager update
but it didn't help.

I solved this problem by specifying the location of the chromedriver executable using the argument Dwebdriver.chrome.driver. This argument should be set when starting the node.
chromedriver documentation

Related

How to run selenium java test in linux in non-headless mode through docker

I know it works fine when I run in headless mode.
However is it possible to run in non-headless mode?
I've installed xvfb through docker and setting
ENV DISPLAY=:99
While running the test
docker run -e Xvfb ${DISPLAY} gradle <task name>
It always gives the error as
org.openqa.selenium.WebDriverException: 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.)
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: '4c3a51d1d7', ip: '<ip>', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.87-linuxkit-aufs', java.version: '1.8.0_222'

running selenium webdriver with firefox profile results in WebDriverError: connection refused

I am trying to start a selenium test with the following command
selenium-side-runner --server http://127.0.0.1:4444/wd/hub --debug -c
"browserName='firefox' moz:firefoxOptions.args=[-profile, /home/seluser.
/firefox-profile/myprofile]" --output-directory ~/out ~/portallogin.side
The profile is loaded correctly in firefox then but the test fails to run with the following exception:
Test suite failed to run
WebDriverError: connection refused
Build info: version: '3.141.59', revision: '82b03c358b', time: '2019-04-30T22:04:50'
System info: host: 'd871aae50a23', ip: '172.17.0.3', os.name: 'Linux', os.arch:
'amd64', os.version: '4.4.0-1075-aws', java.version: '1.8.0_212'
Driver info: driver.version: unknown
remote stacktrace:
at Object.checkLegacyResponse (../../../usr/lib/node_modules/
selenium-side-runner/node_modules/selenium-webdriver/lib/error.js:585:15)
at parseHttpResponse (../../../usr/lib/node_modules/
selenium-side-runner/node_modules/selenium-webdriver/lib/http.js:551:13)
at Executor.execute (../../../usr/lib/node_modules/
selenium-side-runner/node_modules/selenium-webdriver/lib/http.js:486:26)
While running the same test without the profile beeing loaded is working.
I have found this issue: https://github.com/SeleniumHQ/selenium-ide/issues/616 and it looks like a bug.
I tried to add a .side.yml file but that didn't help yet.
It looks like the loading of a profile is disabling the webdriver functionallity in firefox. Any hints how to get it running?
There is a workaround provided here https://github.com/mozilla/geckodriver/issues/1058#issuecomment-350254437
We need to pass the --marionette-port 2828 during the selenium execution.

Exception when run Serenity tests on Jenkins in Seelnium grid

I run tests on my locale machine (not in grid), and it works. However, when I run on Jenkins, on Linux server in selenium grid, I have strange error:
net.serenitybdd.core.exceptions.SerenityManagedException: The following error occurred: Expected condition failed: waiting for core.common.utils.WebDriverUtil$$Lambda$195/1333459330#4f5c82fa (tried for 30 second(s) with 500 MILLISECONDS interval)
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'fr-woqa01', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.16.0-4-amd64', java.version: '1.8.0_131'
Driver info: net.thucydides.core.webdriver.WebDriverFacade
at net.serenitybdd.core.exceptions.SerenityManagedException.detachedCopyOf(SerenityManagedException.java:21)
at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:419)
at net.thucydides.core.steps.StepInterceptor.runOrSkipMethod(StepInterceptor.java:151)
at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:138)
at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:69)
at serenity.steps.HomePageSteps$$EnhancerByCGLIB$$c60d4147.openPage()
at jbehave.scenariosteps.LoginPageScenario.navigateToPage(LoginPageScenario.java:26)
(reflection-invoke)
at org.jbehave.core.steps.StepCreator$ParametrisedStep.perform(StepCreator.java:733)
at org.jbehave.core.embedder.PerformableTree$FineSoFar.run(PerformableTree.java:346)
I run test using command:
-pl ui verify -Dstory.file.name=${story_name} -Denv.config.file=qa.properties -Dwebdriver.remote.url=http://localhost:4444/wd/hub -Dwebdriver.remote.driver=chrome -Dwebdriver.remote.os=LINUX -Dchrome.switches="--no-sandbox,--ignore-certificate-errors,--homepage=about:blank,--no-first-run, --disable-gpu, --disable-impl-side-painting, --disable-gpu-sandbox, --disable-accelerated-2d-canvas, --disable-accelerated-jpeg-decoding, --test-type=ui"
Any help?
The error tells serenity cannot talk to webdriver. Which could be either due to chromedriver not avaliable on the jenkins slave/jenkins machine or chrome itself not installed on the jenkins machine.
Run these commands on to check if chrome /chrome driver is installed on jenkins machine
which chromedriver
which google-chrome

Protractor tests fail to start on Safari Sierra and throwing driver.version: unknown, SessionNotCreatedError error

Protractor version: 5.1.2
Safari version: 10.1.2
I have enabled 'Allow Remote Automation' from Safari -> Develop and started the safari driver from cmd using the following command:
/usr/bin/safaridriver -p 8844
Now, trying to run the protractor tests using protractor conf.js. The tests fail to start with the following logs:
Build info: version: '3.5.1', revision: '9c21bb67ef', time: '2017-08-16T21:10:06.092Z'
System info: host: 'dyn-49-127-9-116.its.monash.edu.au', ip: 'fe80:0:0:0:479:1a15:751b:51d6%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_144'
Driver info: driver.version: unknown
[15:28:40] E/launcher - SessionNotCreatedError: Could not create a session: You must enable the 'Allow Remote Automation' option in Safari's Develop menu to control Safari via WebDriver. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 32 milliseconds
Build info: version: '3.5.1', revision: '9c21bb67ef', time: '2017-08-16T21:10:06.092Z'
System info: host: 'dyn-49-127-9-116.its.monash.edu.au', ip: 'fe80:0:0:0:479:1a15:751b:51d6%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_144'
Driver info: driver.version: unknown
at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
at SessionNotCreatedError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:214:5)
at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:505:15)
at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:440:13)
at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
at createDriver (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:167:33)
at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:632:14)
at Hosted.getNewDriver (/usr/local/lib/node_modules/protractor/lib/driverProviders/driverProvider.ts:60:29)
at Runner.createBrowser (/usr/local/lib/node_modules/protractor/lib/runner.ts:225:39)
at q.then.then (/usr/local/lib/node_modules/protractor/lib/runner.ts:391:27)
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
[15:28:40] E/launcher - Process exited with error code 19
I figured out the issue. Since built in safari driver has a limitation of only one browser window at a time, I quit all the running safari windows and ran the tests again. Worked perfectly fine :)
Reference:
https://webkit.org/blog/6900/webdriver-support-in-safari-10/
Kinda tricky, because currently it's not quite working due webdriver/selenium incompatibilities. We are hoping that, with the new webdriver release, it will work. See here.

Unable to work with Chrome browser using Selenium webdriver in codeception

Starting selenium + chrome driver with this is command
java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium.jar
It start the server
This is my acceptance.suite.yml file
class_name: AcceptanceTester
modules:
enabled:
- WebDriver:
url: ''
browser: chrome
window_size: 1280x768
curl:
CURLOPT_TIMEOUT: 60
This is what i am receiving as error when i try to execute the test case
[Facebook\WebDriver\Exception\UnknownServerException]
unknown error: cannot parse capability: proxy
from unknown error: must be a dictionary
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.2 x86_64) (WARNING: The server d
id not provide any stacktrace information)
Command duration or timeout: 518 milliseconds
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'FR301-216', ip: '172.16.102.106', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
This is an existing bug in the new codeception version (2.1.5 and above). The solution is to downgrade your codeception version to 2.1.4.