wdio - ERROR: Unable to create new service: ChromeDriverService - selenium

When I try to run tests with wdio I am getting ERROR: Unable to create new service: ChromeDriverService It also says Driver info: driver.version: unknown
In my wdio.conf.js file, I have
seleniumArgs: {
version: '3.141.0',
drivers: {
chrome: {
version: '2.43'
},
firefox: {
version: '0.23.0'
}
}
},
seleniumInstallArgs: {
version: '3.141.0',
drivers: {
chrome: {
version: '2.43'
},
firefox: {
version: '0.23.0'
}
}
},
Any idea what I am doing wrong here, or what other information I could provide? The full error is:
ERROR: Unable to create new service: ChromeDriverService
Build info: version: '3.141.0', revision: '2ecb7d9a', time: '2018-10-31T20:22:52'
System info: host: '<me>', ip: '<my_ip>', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_212'
Driver info: driver.version: unknown

I don't know if this will help anyone, but the way I fixed this was to do locate selenium on my machine and just delete everything. I wonder if global selenium was messed up or something? After I did npm install in my repository again, the tests were able to run with ChromeDriverService.

This error message...
ERROR: Unable to create new service: ChromeDriverService
Build info: version: '3.141.0', revision: '2ecb7d9a', time: '2018-10-31T20:22:52'
System info: host: '<me>', ip: '<my_ip>', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_212'
Driver info: driver.version: unknown
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are trying to use chrome=2.43 which is an invalid version.
Your chromedriver version is unknown to us.
Release Notes of chromedriver=77.0 clearly mentions the following :
Your Selenium Client version is 3.141.0 of 2018-10-31T20:22:52 which is almost a year older.
Your JDK version is 1.8.0_111 which is pretty ancient.
So there is a clear mismatch between the Selenium Client v3.141.0 , ChromeDriver and the Chrome Browser
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v77.0 level.
Chrome is updated to current Chrome Version 77.0 level. (as per ChromeDriver v77.0 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test as non-root user.

Related

Laravel + sail + dusk => Error: Could not start a new session [...] Chrome failed to start

I just can't get Laravel dusk running. I've searched the internet and tried almost everything. I hope anyone knows the trick.
To rule out any self introduced problems I stated with a brand new Laravel project: curl -s "https://laravel.build/example-app" | bash. I'm using a Macbook Air (M1 chip) and therefore I have to change the docker-compose.yml and add platform=linux/amd64 to the containers. Thereafter ran ./vendor/bin/sail build and started up the containers. Next installed Dusk: ./vendor/bin/sail composer require --dev laravel/dusk and ran the install command (./vendor/bin/sail artisan dusk:install) as by the documentation.
At this point no additional modifications in any file have been made. Laravel Dusk ships with the default browser test. (tests/Browser/ExampleTest.php) When I run the command ./vendor/bin/sail dusk the following error will show:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\SessionNotCreatedException: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(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: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '64671e354051', ip: '192.168.32.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.76-linuxkit', java.version: '11.0.13'
Driver info: driver.version: unknown
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '64671e354051', ip: '192.168.32.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.76-linuxkit', java.version: '11.0.13'
Driver info: driver.version: unknown
/var/www/html/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:125
/var/www/html/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:372
/var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:131
/var/www/html/tests/DuskTestCase.php:46
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:219
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php:243
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:220
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:98
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:66
/var/www/html/tests/Browser/ExampleTest.php:21
What I tried
The files in ./vendor/laravel/dusk/bin/ have the right permissions.
./vendor/bin/sail artisan dusk:chrome-driver --all => ChromeDriver binary successfully installed for version 100.0.4896.60. . But the same dusk error will show.
Tried to run the ChromeDriver directly: ./vendor/bin/sail bash => ./vendor/laravel/dusk/bin/chromedriver-linux. This results in an error:
./vendor/laravel/dusk/bin/chromedriver-linux: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
I Found an other StackOverflow post to fix this issue by installing the following packages via the sail root-shell: apt update; apt install libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev;. Now the chromedriver-linux is starting without errors. Dusk still fails with the same error.
Has anyone a clue?
I was getting the same error when running sail artisan dusk.
When started using sail dusk instead everything worked.

WebDriverException: unknown error: Chrome failed to start: exited abnormally error running Selenium Grid on Server using ChromeDriver and Chrome

Good evening,
I tried to run my automated tests on a server with Eclipse / Selenium and TestNG. So far the configuration of Selenium Grid worked fine. I got the response:
23:02:55.068 INFO - Selenium Grid hub is up and running
23:03:30.488 INFO - Registered a node http://81.169.xxx.xxx:5555 <br>
23:05:25.423 INFO - Registering the node to the hub: http://81.169.xxx.xxx:4444/grid/register
23:05:25.432 INFO - The node is registered to the hub and ready to use
Here's my example code:
#Test
public void executeOnServer() throws MalformedURLException {
System.out.println("Test started");
DesiredCapabilities dcp = new DesiredCapabilities();
dcp.setBrowserName("chrome");
dcp.setPlatform(Platform.ANY);
WebDriver driver = new RemoteWebDriver(new URL("http://81.169.xxx.xxx:5555/wd/hub/"), dcp);
driver.manage().window().maximize();
driver.get("https://google.de");
driver.quit();
}
Unfortunately I got the error:
[RemoteTestNG] detected TestNG version 6.14.3
Test started
FAILED: executeOnServer
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: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'h28xxxxx.stratoserver.net', ip: '81.169.xxx.xxx', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0', java.version: '1.8.0_252'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x559967ec9ea9 <unknown>
The path to the chromedriver is:
usr/local/bin/chromedriver
Installed version:
https://chromedriver.storage.googleapis.com/index.html?path=**84.0.4147.30**/chromedriver_linux64.zip
Do you have any idea how I could fix the error? Had a look at different sites with this error, no solution is working for me.
This error message...
Test started
FAILED: executeOnServer
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: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'h28xxxxx.stratoserver.net', ip: '81.169.xxx.xxx', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0', java.version: '1.8.0_252'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x559967ec9ea9 <unknown>
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=84.0
Possibly you are using the latest chrome=84.0
Your Selenium Client version is 3.4.0 of revision: 'unknown', time: 'unknown'
So that implies the ChromeDriver is unable to interact with the Selenium bindings as there is a clear mismatch between Selenium v3.4.0 and the ChromeDriver v84.0
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v84.0 level.
Chrome is updated to current Chrome Version 84.0 level. (as per ChromeDriver v84.0 release notes)
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Take a System Reboot.
Execute your #Test as non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

How to set chromeDriver location in Protractor project

In my Protractor project I get below error when execute npm test command
21:55:20] E/runner - Unable to start a WebDriver session.
[21:55:20] E/launcher - Error: SessionNotCreatedError: Unable to create new service: ChromeDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '00000FJ26VN2', ip: '172.30.161.17', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: unknown
I tried below solution and didn't work for me.
Solution 1
This couldn't do due to my machine restriction
Other question I have is even after replacing the correct chromedriver in the below location when I start the server it still shows the wrong one. (i.e. chromedriver_75.0.3770.8.exe, But I replace that with chromedriver_74.0.3729.6.exe which is my current browser version.
File Location: protractor-cucumber-typescript\node_modules\protractor\node_modules\webdriver-manager\selenium
logs when start the server
λ npm run webdriver-start
> protractor-typescript-cucumber#4.0.0 webdriver-start c:\Repository\GitExt\Protractor\protractor-cucumber-typescript
> webdriver-manager start
[22:08:04] I/start - java -Dwebdriver.chrome.driver=c:\Repository\GitExt\Protractor\protractor-cucumber-typescript\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_75.0.3770.8.exe -Dwebdriver.gecko.driver=c:\Repository\GitExt\Protractor\protractor-cucumber-typescript\node_modules\protractor\node_modules\webdriver-manager\selenium\geckodriver-v0.24.0.exe -jar c:\Repository\GitExt\Protractor\protractor-cucumber-typescript\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.141.59.jar -port 4444
[22:08:04] I/start - seleniumProcess.pid: 1380
22:08:04.708 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
22:08:04.825 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2019-06-13 22:08:04.883:INFO::main: Logging initialized #446ms to org.seleniumhq.jetty9.util.log.StdErrLog
22:08:05.145 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
22:08:08.881 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
So as a resolution Can I pointing to the chromedriver specifically? What is the relationship between selenium-server-standalone-3.141.59.jar and the chromedriver? Is there a way to find the compatible chromedriver version for this jar
In my case I don't have access to update or downgrade my machine chrome browser version. So how it's possible to change the web driver version to align with chrome browser version.
I figured out the issue here and managed to have resolution.
Problem : Even though I placed the matching chromedriver.exe in path (c:\Repository\GitExt\Protractor\protractor-cucumber-typescript\node_modules\protractor\node_modules\webdriver-manager\selenium) it's still looking for the original version which is coming fromwebdriver-update command.
So what I did was
Removed chromedriver from the above path.
Add the preferred one in some folder location and set that in env. variables. So if the driver is missing in the project folder it always goes to set path in the env. variables which the right one.
Despite of above solution I just wondering how I can change the driver version when run webdriver-update command?

Selenium Grid with Protractor: SessionNotCreatedError at Object.checkLegacyResponse

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

org.openqa.selenium.SessionNotCreatedException because of "Chrome version must be >= 64.0.3282.0" although version is 65.0.3325.181 on Travis CI

While I was attempting to extend Arquillian PrimeFaces's .travis.yml with a setup for phantomjs and chromeheadless browser driver for functional tests with Selenium, I experienced
java.lang.RuntimeException: Could not create statement
Caused by: java.lang.RuntimeException:
Unable to instantiate Drone via org.openqa.selenium.chrome.ChromeDriver(Capabilities): org.openqa.selenium.SessionNotCreatedException: session not created exception: Chrome version must be >= 64.0.3282.0
(Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.4.0-101-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 564 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'travis-job-bdbf5b81-b2fa-4377-b5de-da7743f04986', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-101-generic', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver
Caused by: org.openqa.selenium.SessionNotCreatedException:
session not created exception: Chrome version must be >= 64.0.3282.0
(Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.4.0-101-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 564 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'travis-job-bdbf5b81-b2fa-4377-b5de-da7743f04986', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-101-generic', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver
So, I updated chromium-browser with sudo add-apt-repository --yes ppa:saiarcot895/chromium-dev && sudo apt-get update && sudo apt-get install --yes chromium-browser and verified that it's the only Chrome binary and has a matching version with which -a chromium-browser && chromium-browser --version which reveals that the only binary is /usr/bin/chrominum-browser and has version 65.0.3325.181. However, the error persists.
I researched and found issues with Chrome on Travis CI like
https://github.com/travis-ci/travis-ci/issues/938 which is about permissions (as opposed to versions)
Chromedriver on Travis-CI which summarizes issues
and checked the Arquillian web driver configuration options for Chrome which don't seem to include one to expose the actual pick up of the ghost 64.x binary.
An example run of the failure can be found at https://travis-ci.org/krichter722/arquillian-primefaces/jobs/364342730.
In your question you have mentioned about using Chrome v65.0.3325.181 but the error stack strace shows different versions as follows :
Caused by: org.openqa.selenium.SessionNotCreatedException:
session not created exception: Chrome version must be >= 64.0.3282.0
This essentially means ChromeDriver is unable to detect the right version of chrome binary. It appears you either have installed multiple instances of Chrome Browsers and have multiple instances of chrome binaries within your system or there are multiple stray instances of chrome binaries available within your system.
Solution
You must ensure that Chrome is installed at the optimum location as the server expects you to have Chrome installed in the default location for each system as per the snapshot below :
Note : For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. You can also override the Chrome binary location following the documentation Using a Chrome executable in a non-standard location.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.