browsertime --- The ChromeDriver could not be found on the current PATH - java

Good night, i am trying to use the next https://github.com/sitespeedio/browsertime, then i did the next
npm install browsertime -g
browsertime https://www.sitespeed.io/
When i executed the next command browsertime https://www.sitespeed.io/, but i am getting the next error
[2022-03-30 18:47:29] INFO: Running tests using Chrome - 3 iteration(s)
[2022-03-30 18:47:29] INFO: chrome failed to start, trying 2 more time(s): The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found on your PATH.
[2022-03-30 18:47:29] INFO: chrome failed to start, trying 1 more time(s): The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found on your PATH.
[2022-03-30 18:47:29] INFO: chrome failed to start, trying 0 more time(s): The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found on your PATH.
My chromedriver version is
C:\Users\wilso>ChromeDriver Starting ChromeDriver 100.0.4896.60
(6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896#{#875})
on port 9515 Only local connections are allowed. Please see
https://chromedriver.chromium.org/security-considerations for
suggestions on keeping ChromeDriver safe. ChromeDriver was started
successfully.

Related

org.openqa.selenium.SessionNotCreatedException: Message: Could not start a new session. Response code 500 error using Selenium Java

A window appears after launch and immediately disappears, I can not understand what's wrong. Google except for the latest version, selenium is also set to the LATEST parameter (nothing changes with a specific version).
Error:
org.openqa.selenium.SessionNotCreatedException: Message: Could not start a new session. Response code 500. Message: session not created
Code:
Error:
Update your chromedriver version, it seems your your browser and browser current driver version aren't same.
https://chromedriver.storage.googleapis.com/index.html?
This error message...
org.openqa.selenium.SessionNotCreatedException: Message: Could not start a new session. Response code 500. Message: session not created:
.
Driver info: org.openqa.selenium.chrome.ChromeDriver
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. google-chrome session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chrome=99.0
Release Notes of ChromeDriver v99.0 clearly mentions the following :
Supports Chrome version 99
But your chromedriver version is not getting detected.
Driver info: org.openqa.selenium.chrome.ChromeDriver
Your JDK version 1.8.0_281 is also old and ancient.
So most possibly there is a mismatch between jdk version, chromedriver version and the chrome=99.0
Solution
Ensure that:
JDK is upgraded to current levels JDK 8u311.
ChromeDriver is updated to current ChromeDriver v99.0 level.
Chrome Browser is updated to current chrome=99.0 (as per chromedriver=99.0.4844.51 release notes).
If some one is on linux,
some distros install /usr/bin/google-chrome-stable, web driver manager tries to retry the version of chrome with the command
/usr/bin/google-chrome --version
Since that bin does not exists, is going to fail; The solution is very simple
just a simbolic link to google-chrome
# ln -s /usr/bin/google-chrome-stable /usr/bin/google-chrome
More than an answer this continues with the question.
I'm using serenity-bdd with the following characteristics:
Ubuntu: 22.04.1
Google-Chrome: 106.0.5249.103
Chrome driver: 106.0.5249.61
And the generated message error is:
<<< ERROR!
net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class org.openqa.selenium.chrome.ChromeDriver
Caused by: net.thucydides.core.webdriver.DriverConfigurationError:
Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (Could not start a new session. Response code 500. 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.)
Was trying with different driver combinations and none of them are working. Funny enough when i run on windows with the same configuration all works.
Starting ChromeDriver 109.0.5414.74 (e7c5703604daa9cc128ccf5a5d3e993513758913-refs/branch-heads/5414#{#1172}) on port 48484
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Failed to create Chrome process.
Host info: host: 'A-LAPTOP', ip: '192..0.'
Build info: version: '4.7.2', revision: '4d4020c3b7'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.5'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}}]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:148)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:106)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:535)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:228)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:156)
at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:101)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:82)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:50)
at com.project.skyfall.Browser_Drivers.main(Browser_Drivers.java:13)
In short, you need to install the previous version of the web driver with such a problem

ChromeDriver was[ 1s6t4a7r3te4d5 0s3u7c.c0e6s6s]f[uSlElyV.E RE]: bind() failed: Cannot assign requested address (99)

I am facing the issue while running the Selenium tests (chrome driver) on circle CI using docker. I am not able to launch the URL even google.com , I have tried with every possible solution (from google) like headless mode changing the ip, whilisting ips everything but nothing worked for me.
[TestNG-test=Create_Users-1] INFO io.github.bonigarcia.wdm.WebDriverManager - Using chromedriver 99.0.4844.51 (resolved driver for Chrome 99)
[TestNG-test=Create_Users-1] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as /home/circleci/.cache/selenium/chromedriver/linux64/99.0.4844.51/chromedriver
[TestNG-test=Create_Users-1] INFO io.github.bonigarcia.wdm.WebDriverManager - Using chromedriver 99.0.4844.51 (resolved driver for Chrome 99)
[TestNG-test=Create_Users-1] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as /home/circleci/.cache/selenium/chromedriver/linux64/99.0.4844.51/chromedriver
Starting ChromeDriver 99.0.4844.51 (d537ec02474b5afe23684e7963d538896c63ac77-refs/branch-heads/4844#{#875}) on port 5218
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeD[r1i6v4e8r1 56w8a0s 5s.t4a8r9t]e[dS EsVuEcRcEe]s:s fbuilnldy(.)
failed: Cannot assign requested address (99)

Selenium "can't kill an exited process" [duplicate]

Server: Raspberry Pi 3
OS: Dietpi - version 159
Geckodriver version: 0.22 for arm
Firefox version: 52.9.0
Python version: 3.5
Selenium version: 3.14.1
Gecko is executable, and is located in /usr/local/bin/
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.firefox.options import Options
import time
options = Options()
options.set_headless(headless=True)
driver = webdriver.Firefox(firefox_options=options)
print('Need your login credential')
username = input('What is your username?:\n')
password = input('What is your password?:\n')
...
...
Output:
root#RPi3:~# python3.5 ITE-bot.py
Traceback (most recent call last):
File "ITE-bot.py", line 12, in <module>
driver = webdriver.Firefox(firefox_options=options)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process
Any idea what is wrong? I've tried google without luck.
If you are running Firefox on a system with no display, make sure you use headless mode.
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
Also, make sure you have compatible versions of Firefox, Selenium, and Geckodriver:
https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
Thumb rule
A common cause for Browsers to crash during startup is running WebDriver initiated Browsers as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Browser as a regular user instead.
This error message...
selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Your GeckoDriver version is 0.22.0.
Release Notes of GeckoDriver v0.21.0 (2018-06-15) clearly mentions the following:
Firefox 57 (and greater)
Selenium 3.11 (and greater)
Your Firefox version is 52.9.0.
So there is a clear mismatch between GeckoDriver v0.22.0 and the Firefox Browser v57
Solution
Upgrade GeckoDriver to GeckoDriver v0.22.0 level.
GeckoDriver is present in the specified location.
GeckoDriver is having executable permission for non-root users.
Upgrade Firefox version to Firefox v62.0.2 levels.
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.
Execute your Selenium Test as a non-root user.
GeckoDriver, Selenium and Firefox Browser compatibility chart
I was on headless mode, using correct versions of everything, and the only way to get out of this error message was not to execute the selenium test as root
Yes checked Start Xvfb before the build can fix the problem, but if you have a job like a pipeline or multibranch pipeline this option is not visible. In the node of your Selenium grid that you go to execute the test you need:
1- Install Xvfb: apt install xvfb
2- Execute Xvfb: /usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 & export DISPLAY=":99"
3- Rerun your node, for example: java -jar selenium.jar -role node -hub http://#.#.#.#:4444/grid/register -capabilities browserName=firefox,plataform=linux -host #.#.#.# -port 1991
This solution worked for me
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
As there can be many different underlying causes for this error it is best to find the root cause setting selenium to use debug level logging. In my case, for Ruby with capybara I needed to set: Selenium::WebDriver.logger.level = :debug. And voilĂ , running the same spec I could see in the logs that a dependency was missing, in my case:
libdbus-glib-1.so.2: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
After installing it all worked fine.
I used:
VS Code
Linunx/Ubuntu:18.10
Nightwatch.js
My problem was that I tried to run Nightwatch (which automatically starts GeckoDriver) from the VS Code terminal.
I had the same problem, and realized that the real problem was some firefox dependencies not being installed inside the docker container I was testing in.
Try to initiate firefox and check if it returns an error.
As Nico and jay have stated you need to check the logs to see the details of the error. As you might use different systems, you can specify the path where the log is stored (i.e. "/tmp/geckodriver.log").
from selenium import webdriver
firefox_options = webdriver.firefox.webdriver.Options()
driver = webdriver.Firefox(log_path="/tmp/geckodriver.log",
options=firefox_options)
In my particular case, what the log said was:
Error: no DISPLAY environment variable specified
That was resolved adding in the options the headless mode before starting the driver. With the line:
firefox_options.set_headless()
I was able to fix this by running my tests with Xvfb. I was running them on a remote server.
I was using Jenkins so I checked the box that looked like this:
Credit to https://www.obeythetestinggoat.com/book/chapter_CI.html
in my case, I was running test cases as root
geckodriver.log
1576076416677 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofilenCbl2e"
Running Firefox as root in a regular user's session is not supported. ($HOME is /home/seluser which is owned by seluser.)
1576077143004 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile7wpSQ7"
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: telemetry
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: about:reader*
1576077145372 Marionette INFO Listening on port 35571
1576077145423 Marionette WARN TLS certificate errors will be ignored for this session
1576077200207 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofilenhoHlr"
Running Firefox as root in a regular user's session is not supported. ($HOME is /home/seluser which is owned by seluser.)
i could get around by
cd /home
chown -R root seluser
i woundnt say its correct but it got my job done

Unable to run Java Selenium tests in Jenkins locally using maven using ChromeDriver 2.36.540470 and Selenium

I am running jenkins from tomcat 9 with jenkins . I have configured maven project with following commands in windows batch command.
c:cd C:\Users\Nikhil Udgirkar\workspace\Neon_workspace2\orangehrm
mvn clean test
echo Success
Also configured maven and jdk installations in jenkins
The browser is not launching at all. The execution is stopped at this line only
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Starting ChromeDriver 2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91) on port 39673
Only local connections are allowed.
Mar 25, 2019 9:00:13 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
The test case execution was supposed to start but it is not starting with run paused after aforementioned line in console. Please help
Thanks
This error message...
Starting ChromeDriver 2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91) on port 39673
...implies that the ChromeDriver v2.36 was used to initiate a new Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.36
Release Notes of chromedriver=2.36 clearly mentions the following:
Supports Chrome v63-65
Possibly you are using the currently released chrome=73.0
So there is a clear mismatch between the ChromeDriver v2.36 and the Chrome Browser v73.0
Solution
Upgrade ChromeDriver to ChromeDriver v2.46 level.
Keep Chrome version at Chrome v73 level. (as per ChromeDriver v2.46 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 and install a recent GA and released version of Web Client.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
This got resolved after I created a slave. The tests were getting launched as usual and were visible on foreground with chrome browser.

Jenkins Project not running as Google Chrome is Timing out

Google Chrome updated to version 73.0.3683.86 and Chrome driver was updated to 73.0.3683.68. when triggering a java project(TestNG) from Jenkins(as a service), the program runs indefinitely and does not get into the actual code and is timing out.
Tried downgrading the browser version to Chrome 71 and ran it through ChromeDriver version 2.46. This successfully runs the project. But the Automatic updates from Chrome gets pushed every night and makes it incompatible to the chromedriver version (Chrome version 73 and Chromedriver 2.46 - which will not work).
Tried updating both Chrome and Chromedriver to latest version and it wouldn't work.
Google Chrome is started, TASK MANAGER shows multiple instances of Chrome running (larger than usual number of instances when Chrome is Triggered through Jenkins). Killing random Google Chrome instance allows the program to run sometimes. But, our project requires scheduling projects every day in the morning automatically and hence, manually killing Chrome instance is not an option.
Started by user Automation Tester
Building in workspace D:\Code Backup\Code\General Revenue Content
[XXXXXXXXXX Content] $ cmd /c call C:\Users\a39974p\AppData\Local\Temp\jenkins8618745924723016687.bat
D:\Code Backup\Code\XXXXXXXXXX >run.bat
D:\Code Backup\Code\XXXXXXXXXX >java -cp bin;lib/* org.testng.TestNG testng.xml
Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 6983
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Mar 28, 2019 11:50:44 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
[1553788844.734][SEVERE]: Timed out receiving message from renderer: 600.000
[1553789144.734][SEVERE]: Timed out receiving message from renderer: 300.000
Expected: Chrome shouldn't be timed out and continue to execute the test script.
Actual : Chrome Time out after running for a long time.
I have a similar problem, as far as I understood after test failure chromedriver doesn't close instantly but only after it reaches some timeout value(about 10 mins for me), but with older chromedriver version these closing chromedrivers were not occupying jenkins slots.
As a temporary fix I would advise you to downgrade to chrome v71 and disable auto update
Considering the above comment, I would suggest the use of chrome version more than 72 and chromedriver version 2.46.
Or you can use combination mentioned on -
http://chromedriver.chromium.org/downloads
I have experienced a similar issue while running Selenium tests in headless mode through Jenkins job. The console output was the following:
Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 36079
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Build timed out (after 5 minutes). Marking the build as failed.
Build was aborted
The issue was fixed by adding "--no-sandbox" to the ChromeOptions arguments.

Categories