How does Serenity choose what Chromedriver to use? - selenium-chromedriver

I recently cloned the latest version of serenity-cucumber-starter from https://github.com/serenity-bdd/serenity-cucumber-starter. I took the action-classes branch (as I want to use that as a starting point rather than the screenplay (master) branch) and ran mvn clean verify as instructed in the readme. I got an unusual situation wherein the webdrivermanager that comes with serenity recognised and downloaded the correct version of chromedriver based on my installed chrome but serenity proceeded to start a different version of chromedriver.
Here are the logs:
11:36:55.771 [pool-2-thread-1] INFO n.s.c.w.d.ChromeDriverProvider - Using automatically driver download
11:36:56.248 [pool-2-thread-1] INFO i.g.bonigarcia.wdm.WebDriverManager - Using chromedriver 107.0.5304.62 (since Chrome 107 is installed in your machine)
11:36:56.258 [pool-2-thread-1] INFO i.g.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as /Users/user69/.m2/repository/webdriver/chromedriver/mac64/107.0.5304.62/chromedriver
11:36:56.772 [pool-2-thread-1] INFO n.s.c.w.d.ProvideNewDriver - Instantiating driver
11:36:56.774 [pool-2-thread-1] INFO n.s.c.w.d.ProvideNewDriver - Driver capabilities: Capabilities {acceptInsecureCerts: false, browserName: chrome, chrome.switches: --start-maximized;--test-ty..., goog:chromeOptions: {args: [--start-maximized, --test-type, --no-sandbox, --ignore-certificate-errors;\n, --disable-popup-blocking, --disable-default-apps, --disable-extensions-file-a..., --incognito, --disable-infobars, --disable-gpu, --headless], extensions: []}, loggingPrefs: org.openqa.selenium.logging...}
Starting ChromeDriver 90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430#{#429}) on port 48795
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Of course because the wrong version of ChromeDriver starts the tests fail to run with the following:
Caused by: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (session not created: This version of ChromeDriver only supports Chrome version 90
Current browser version is 107.0.5304.110 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
After webdrivermanager correctly identifies and downloads the correct version of chromedriver how can I instruct serenity to actually use the downloaded version rather than starting some other version?

The bonigarcia library uses the following commands to identify your installed browser version and that's the version it will automatically download.
https://github.com/bonigarcia/webdrivermanager/blob/master/src/main/resources/commands.properties
You may override the driver version serenity is using with the wdm.* properties listed under the advanced configuration section here. https://bonigarcia.dev/webdrivermanager/#advanced-configuration
E.g. pass as environment variable when using maven "mvn clean verify -Dwdm.chromeDriverVersion=107"
But, under normal circumstances you don't need to do so, if automatic driver resolution works.

Related

org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 111 error with Selenium

I am sure that my tests are working correctly. When I run the code I got the error in terminal like,
Scenario: User adds new quick work order to employee from website # src/test/java/Features/5NewQuickJobOrder.feature:12
Starting ChromeDriver 111.0.5563.19 (378a38865270d286695aeb86f190564911ef7bc2-refs/branch-heads/5563#{#251}) on port 4290
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 111
Current browser version is 110.0.5481.97 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-CONJ3EC', ip: '192.168.1.27', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '19.0.2'
Driver info: driver.version: ChromeDriver
Recently Chrome updates itself and my version is now 110.0.5481.97. But somehow it tries the run the test with version 111 shows below. I have no version in my computer such that starts with 111..
Scenario: User adds new quick work order to employee from website # src/test/java/Features/5NewQuickJobOrder.feature:12
Starting ChromeDriver 111.0.5563.19 (378a38865270d286695aeb86f190564911ef7bc2-refs/branch-heads/5563#{#251}) on port 40758
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
I do not use any chromedriver exe in my project folder, I directly use setup and driver intsance.
public static WebDriver initialize_Driver(String browser) {
properties = ConfigReader.getProperties();
if (browser.equals("Chrome")) {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}
#Before
public void before() {
String browser = Reporter.getCurrentTestResult().getTestContext().getCurrentXmlTest().getParameter("browser");
properties = ConfigReader.initialize_Properties();
driver = DriverCreater.initialize_Driver(browser);
}
I will be very glad, if you could help me!
First the solution
To instantiate a specific browser version of ChromeDriver you can use:
WebDriverManager.chromedriver().driverVersion("111.0.5563.19").setup();
Details
This error message...
org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 111
...implies that SessionNotCreatedException was raised as ChromeDriver was unable to 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=110.0.5481.97
But you are using chromedriver=111.0.5563.19
Release Notes of chromedriver=111.0 clearly mentions the following :
Supports Chrome version 111
So there is a clear mismatch between chromedriver=111.0 and the chrome=110.0
Solution
Ensure that:
ChromeDriver is downgraded to ChromeDriver v110.0 level.
Chrome Browser is updated to current chrome=110.0 (as per chromedriver=110.0 release notes).
Selenium is upgraded to current released Version 4.8.0.

Could not start a new session. Response code 500. Message: session not created: This version of ChromeDriver only supports Chrome version 100

I am in the learning phase in the automation.
In my first program, when I am trying to run it, getting below error.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 100.0.4896.60 (6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896#{#875}) on port 57583
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: session not created: This version of ChromeDriver only supports Chrome version 100
Current browser version is 102.0.5005.63 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
Build info: version: '4.2.0', revision: '86eb611648'
It will be a great help if anybody help me in this to resolve.
Thanks in advance.
So first thing you should do is update your google chorme.
Click on the 3 dots > help > about google chrome > and check if it is already up to date.
After updating, search for webdrive for google chrome.
Download the version that is the same as yours, for example.
Mine is 103. Then download driver 103.
When you've downloaded the driver, unzip it and insert it into your drivers folder on your user's C:.
Example:
C:\Users\lucas\driver
After putting it in, try to run your program again.
Note * I found this out by going to my system variables and accessing the Paths that were in there.
You can probably find and check beforehand. If there is something in one of your paths like this:
C:\Users\lucas\driver
and paste exactly in that path. It will work.

Find Chrome Driver Version Used

We have below webdrivermanager version in our pom. But is there anyway you can see/find the version of chromedriver used by it?:-
<webdrivermanager.version>3.8.0</webdrivermanager.version>
Ok, I have found it from trace while running the tests:-
Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987#{#882}) on port 36187
Only local connections are allowed.

WebdriverIO - Test fails with error Openfin

I have been trying to setup automation testing for our openfin application using the below repo as base
https://github.com/openfin/webinar-automated-integration-tests
I am using Openfin (Chrome version 61.0.3163.100) and Chromedriver 2.40.565498
When I run "npm test", the openfin application opens up. But the tests don't run. After waiting for sometime, it throws the below error in console.
ERROR: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.16299 x86_64)
chrome
I tried using other versions of chromedriver like 2.33, 2.34, 2.37, 2.38, 2.39, 2.41. Using these versions even the application doesn't appear. So, I guess the chromedriver version I am using is correct. I have also tried adding the below arguments to chromeOptions
--remote-debugging-port=9222,--no-sandbox,--headless,--disable-gpu
They didn't solve my issue. Not sure what is causing the issue. Any help would be much appreciated. Thanks in advance. Cheers!
This error message...
ERROR: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.16299 x86_64)
...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=2.40
Release Notes of chromedriver=2.40 clearly mentions the following :
Supports Chrome v66-68
Presumably you are using chrome=61.0
Release Notes of ChromeDriver v2.33 clearly mentions the following :
Supports Chrome 60-62
Your Selenium Client version is unknown to us.
So there is a clear mismatch between ChromeDriver v2.40 and the Chrome Browser v60.0
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v80.0 level.
Chrome is updated to current Chrome Version 80.0 level. (as per ChromeDriver v80.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 and install a recent GA and released version of Web Client.
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.

IDEA Javascript Chrome Remote Debugging

I try to get the JetBrains IDE Support 2.0.9 running with my IDEA 2017.1.4.
IDEA says that it waits for connection from the Support Extension on IDE port 63342.
The problem I found is that the Chrome Plugin gets an 404 error when it tries to create the WebSocket Connection
Ready to load system latest for IntelliJ IDEA 2017.1.4 (127.0.0.1:63342)
logging.kt:43 System latest loaded for IntelliJ IDEA 2017.1.4 (127.0.0.1:63342)
socket.kt:50 WebSocket connection to 'ws://127.0.0.1:63342/jsonRpc?v=2.0.9&f=Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F59.0.3071.115%20Safari%2F537.36' failed: Error during WebSocket handshake: Unexpected response code: 404
value # socket.kt:50
value # socket.kt:69
value # platform.kt:32
value # chrome.kt:23
$f9 # console.kt:57
$fb # bootstrap.kt:157
$fc # bootstrap.kt:174
logging.kt:51 onerror [object Event]
value # logging.kt:51
$f4 # socket.kt:92
I try to find some solution via Google but the keyword "jsonRpc" polluted the results with no connections to IDEA that helped.
Further informations:
Network has no access to Internet
Chrome Version 59.0.3071.115 64-Bit
OS: Win 7 64bit
IDEA 2017.1.4
Plugin 2.0.9
Installed IDEA Plugins (External Ones)
Atlassian Connector for IntelliJ IDE (Version 3.0.16,SVN:1504201227)
CodeReview for IntelliJ IDEA (Version 0.5.4)
Grep Console (Version 5.9.141.000)
IDETalk (Version 145.258.11)
Lombok Plugin (Version 0.14.16)
SonarLint (Version 2.3.2)
String Manipulatio (Version 4.2.132.445)
Maven Helper (Version 3.1.138.1503)
I know that some could be very old but we don't have Internet Access at our Workstation to se updates or even update very good
PS: is there some kind of documentation what all the WebInterface URLs in IDEA are/how the Interface is constructed?