Downgrade chromedriver version during runtime using webdrivermanager - selenium-chromedriver

Problem:
Facing an issue to downgrade chrome driver version during runtime.
Background:
Using chrome + Docan(needs chrome driver with v2.33) to do automation test of an application.
First, start chrome with driver version: 91.0.4472.124.
Then, switch to Docan which needs chrome driver with version 2.33.
Code:
WebDriverManager webDriverManager = null;
Initial:
webDriverManager = WebDriverManager.chromedriver();
Switch:
WebDriverManager.chromedriver().clearResolutionCache();
webDriverManager = WebDriverManager.chromedriver().driverVersion("2.33");
webdriver.avoidBrowserDetection();
Behavior:
After switch:
System.getProperty("webdriver.chrome.driver") --> return path for version 2.33
In log:
I could see chromedriver version is still 91
UI action:
Docan is not fully supported for actions like click.(It supports fine if driver is 2.33, tried with IE + Docan)
Is there any suggestion to make it work?

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.

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.

Selenium WebDriverException: unknown error: call function result missing 'value' while calling sendkeys method

When trying to call Sendkeys method in selenium webdriver it is displaying below error:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.1.7600 x86_64) (WARNING: The server did not provide any stacktrace information)
Selenium Jarversion: 3.10.0
The error says it all :
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.1.7600 x86_64)
Your main issue is the version compatibility between the binaries you are using as follows :
You are using chromedriver=2.27
Release Notes of chromedriver=2.27 clearly mentions the following :
Supports Chrome v54-56
You are using chrome=65.0
Release Notes of ChromeDriver v2.36 clearly mentions the following :
Supports Chrome v65-66
Your Selenium Client version is 3.10.0.
Your JDK version is unknown to us.
So there is a clear mismatch between the ChromeDriver version (v2.27) and the Chrome Browser version (v65.0)
Solution
Upgrade ChromeDriver to ChromeDriver v2.36 level.
Keep Chrome version at Chrome v65.x levels. (as per ChromeDriver v2.36 release notes)
Clean your Project Workspace 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 Chrome version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Chrome.
Execute your #Test.
An older version of the ChromeDriver is being spun off when the test is being run; to remedy:
Ensure that you've gotten your browser up to date (v65-67) and get the latest version of the ChromeDriver executable(v2.38)
Extract the ChromeDriver and explicitly set the System property when initializing the ChromeDriver object...
Ex:
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver.exe");
WebDriver driver = new ChromeDriver();
I had encountered the same issue. The issue got resolved by updating the chromedriverexe. please check the compatibility of your chrome browser with chrome driver here To download chromedriver

Coded UI Test Selenium Chrome Driver

Selenium chromedriver;
The open chrome driver window displays:
Starting ChromeDriver (v2.8.241075) on port 10820
[8804:7492:0110/155544:ERROR:chrome_views_delegate.cc(176)] NOT IMPLEMENTED
[8804:7492:0110/155544:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
[8804:7492:0110/155544:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
Windows 8
ChromeDriver 2.8
Selenium 2.39
Chrome version 32.0.1700.102 m
Coded UI Test;
BrowserWindow.CurrentBrowser = "chrome";
var browser = BrowserWindow.Launch(new Uri("http://www.google.com"));
...
To run a chrome driver refer below code.
You can download the driver from
http://chromedriver.storage.googleapis.com/index.html
Step 1 :
System.setProperty("webdriver.chrome.driver",driverPath+"\\chromedriver.exe");
Step 2
ChromeDriver driver = new ChromeDriver();
driver.get(YOUR_URL_HERE)
In C#, you have to write following code:
IWebDriver driver = new ChromeDriver("fullpath to chrome driver exe");
driver.Navigate().GoToUrl("http://www.google.com");
You can download the Chrome Driver from this URL:
https://sites.google.com/a/chromium.org/chromedriver/downloads
Change the url to https://www.google.com.
Right now you are using http://www.google.com

cannot run Selenium tests on some browsers

i have tests made with Mink using Selenium 2 driver. everything is working OK under Windows 7 with Firefox, Chrome and IE and Ubuntu 12.10 with Firefox. the problems are:
when i try to run test on Opera (Windows 7) it launches but it cannot find any element on the page - the test fails.
when i try to run test on Chrome (Ubuntu 12.10) using chromedriver - the system returns an error "An unknows server side error occured while processing the command".
when i try to run test on Opera (Ubuntu 12.10) - the system returns an error "No response in timely fashion".
what am i doing wrong? how can i make work Opera in Windows and Opera and Chrome in Ubuntu?
p.s. i use system as Selenium Grid 2
For me on Windows it work:
java -jar "c:\selenium-server-standalone-2.35.0.jar" -forcedBrowserMode "*googlechrome c:\Program Files\Google\Chrome\Application\chrome.exe"
May be for u:
java -jar "c:\selenium-server-standalone-2.35.0.jar" -forcedBrowserMode "*opera c:\Program Files\pathToOpera.exe"
It might be a matter of Operative System as well.
I am developing on a Windows machine and my colleagues are working on Mac.
They had just included the chrome driver for mac, so tests didntĀ“t work on my computer.
I had to do this:
if (OS.indexOf("win") >= 0) {
System.setProperty("webdriver.chrome.driver", "src/test/resources/selenium_drivers/chromedriver.exe");
} else if ((OS.indexOf("mac") >= 0)) {
System.setProperty("webdriver.chrome.driver", "src/test/resources/selenium_drivers/chromedriver");
}
Two different driversa that you can find at http://chromedriver.storage.googleapis.com/index.html