Webdriver manager downloads the latest version of chrome driver which is not supported for the latest chrome version for windows - protractor

I have the following piece of line in my package.json -
"webdriver-manager": "^12.1.7",
And when my protractor code runs in jenkins pipeline it throws me an error -
[01:11:30] I/testLogger - [chrome #01-12] PID: 12008
[chrome #01-12] Specs: C:\coco-e2e-5-2-2021\coco-web-client\apps\coco-e2e\outputFiles\JSFiles\view-comms-docs-tbs\view-comms.spec.js
[chrome #01-12]
[chrome #01-12] [01:11:29] I/direct - Using ChromeDriver directly...
[chrome #01-12] [01:11:30] E/runner - Unable to start a WebDriver session.
[chrome #01-12] [01:11:30] I/runnerCli - session not created: This version of ChromeDriver only supports Chrome version 90
[chrome #01-12] Current browser version is 89.0.4389.128 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[chrome #01-12] (Driver info: chromedriver=90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430#{#429}),platform=Windows NT 10.0.18363 x86_64)
What I see from Chrome driver's official release is, the latest chromedriver version is 90.0.4430.24.
But the latest chrome version for windows is 89.0.4389.128. And this is what causing the mismatch.
There's a chrome version 90.0.4430.66 released on 14th April, 2021 but that's compatible with Android chrome and not with windows chrome.
Now how do I tweak my code so that it will not take the chromerdriver v89.0.4389.23 instead of v90.0.4430.24?
The protractor test will not run locally but on a different system via jenkins. So updating chromedriver locally may solve my problem for debugging but not for running the test in the pipeline.
Any leads are very much appreciated. Thanks in advance.

what you actually need to do is to match a version of your local chrome to the version of chromedriver (the driver is the layer that controls your browser, so it's important to make them correspond to each other). So
First, find out what your version of chrome is. For example, it is 86.0.4240.111
Then, find out what chromedriver version can be used. Take the major version of the browser (first 3 numbers, 86.0.4240 in this case) and find the corresponding version of the driver by going to this url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION} (put the major browser version instead of ${CHROME_VERSION}). You'll see the chromedriver you're looking for is 86.0.4240.22
This is where the trickiest part begins. There are 2 installation of protractor usually:
local
global
I won't go over how to find which one you use, you can look it up. But when you find it, make sure you're updating the right one
When you know which protractor you're updating, go to it's folder and from that folder run npm i webdriver-manager#latest and then node ./bin/webdriver-manager update --gecko=false
when you updated the right webdriver, install the right chromedriver like so
node ./bin/webdriver-manager update --gecko=false --versions.chrome $VERSION
Make sure to put 86.0.4240.22 instead of $VERSION

Related

Fail test in VSC using Robot Framework

Learning RobotFramework using VSC.
Got downloaded chromedriver_win32.zip for Chrome 98 from here::
https://chromedriver.storage.googleapis.com/index.html?path=98.0.4758.80/
When I run my 1st test in VSC I get fail and the message shows:
This version of ChromeDriver only supports Chrome version 93
Current browser version is 98.0.4758.82 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
Why it says Chrome version 93 when it's 98?
Thanks.
You have to replace that chromedriver.exe by the one you have downloaded and extracted.
You need to know where that executable is (being found from the PATH environment variable).

SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 85

Currently i am working protractor UI testing. My testcase is working properly so far, but suddenly it shows a webdriver problem. My current chrome version is 84. But the selenium driver is expecting version 85. Version 85 is still not released.
[14:56:46] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 85
(Driver info: chromedriver=85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183#{#779}),platform=Windows NT 10.0.17134 x86_64)
[14:56:46] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 85
(Driver info: chromedriver=85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183#{#779}),platform=Windows NT 10.0.17134 x86_64)
Either use webdriver-manager to specify your chromedriver version or use --webdriverUpdate=false if running e2e tests
(see: https://github.com/angular/protractor/issues/5460)
There seems to be an issue where webdriver-manager is installing ChromeDriver 85 even though Chrome 84 is the current stable release. Multiple people have reported this issue.
I've posted a workaround in issue 376
Overall, you temporarily can hardcode the version you want when using webdriver-manager, then tell protractor which version to use (since protractor can still try to install 85 and use it).
Here is the copied work-around:
We have webdriver-manager installed as project dependency (npm install --save-dev webdriver-manager)
we call webdriver-manager update --versions.chrome 84.0.4147.30 prior to running our tests. This will install the 84 chromedriver version in ./node_modules/webdriver-manager/selenium/. (We just made this as a npm script in our package.json)
We then update the protractor.conf file to have this line in the root of exports.config: chromeDriver:"./node_modules/webdriver-manager/selenium/chromedriver_84.0.4147.30.exe"**
Protractor still installs chromedriverr 85, but it will use the 84 version.
** In our case, we run our protractor tests in docker, but develop mostly on windows. So I updated the protractor.conf to have this line so that it works in either:
chromeDriver: process.platform === "win32" ? "./node_modules/webdriver-manager/selenium/chromedriver_84.0.4147.30.exe" : "./node_modules/webdriver-manager/selenium/chromedriver_84.0.4147.30"
I have had the same issue but it worked when I updated latest version of protractor which is 7.0.0

directConnect option is not working after upgrading to webdriver-manager 12.1.4

I used to run my protractor tests using directConnect: true option set.
The chromedriver I had at that time was chromedriver2.46
Now with the latest webdriver-manaegr12.1.4, the chromedriver was upgraded to ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29})
If I still continue to use directConnect: true and run my tests, I get the following error
session not created: This version of ChromeDriver only supports Chrome version 75
(Driver info: chromedriver=75.0.3770.8 (681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770#{#40}),platform=Mac OS X 10.14.4 x86_64)
Here is my very simple example: https://github.com/cnishina/protractor542-chrome74 It does not use a Docker container but it works for Chrome 74 with ChromeDriver 74.
Chrome browser + ChromeDriver versions
The output error message looks like session was not created because you are trying to use ChromeDriver 75. I would refer to http://chromedriver.chromium.org/downloads to match the ChromeDriver version to the Chrome browser version. The latest Chrome browser version is 74 so ChromeDriver downloads 74.0.3729.131. If you are still on Chrome browser 71-73, you could use ChromeDriver 2.46. Moving forward, the browser major version and chromedriver version must match. So for Chrome 73, you could use 73.0.3683.68.
Downloading different versions of ChromeDriver
If you need to download a different version of ChromeDriver, you could run the webdriver-manager command: webdriver-manager update --versions.chrome 73.0.3683.68 or to download 2.46, webdriver-manager update --versions.chrome 2.46.

getting an error on trying to launch Chrome using Protractor

I'm trying to launch the browser through Protractor. I downloaded webdriver through terminal by giving webdriver-manager update command. This is downloading the latest chromedriver v74, but the chrome browser is v73.
How to explicitly set the WebDriver version?
I'm getting the following error:
[11:09:13] E/driverProvider - Error code: 135
[11:09:13] E/driverProvider - Error message: session not created: This version of ChromeDriver only supports Chrome version 74
[11:09:13] E/driverProvider - Error: session not created: This version of ChromeDriver only supports Chrome version 74
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29}),platform=Mac OS X 10.14.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.70 seconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'Acsahs-MBP', ip: 'fe80:0:0:0:45:3f89:2e8b:ab96%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.2', java.version: '1.8.0_191'
Driver info: driver.version: unknown
at Local.<anonymous> (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:69:23)
at Generator.throw (<anonymous>)
at rejected (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:5:65)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
[11:09:13] E/launcher - Process exited with error code 135
My config file:
exports.config = {
seleniumaddress:'http://localhost:4444/wd/hub',
specs:['spec.js']
};
is it solved yet? if not then try this.
for my small selenium-webdriver test i did these steps after i researched online and here:
npm install selenium-webdriver
npm install chromedriver
npm install geckodriver and opened file library.js and npm init and ran node library.js (source code below)
Error: (node:14212) UnhandledPromiseRejectionWarning: NoSuchSessionError: invalid session id Some long error related to not same chromedriver version. so i checked the chrome browser version manually in the browser. it was version 73 and my mistake i had downloaded chromedriver version 74.0.
so go to https://chromedriver.storage.googleapis.com/index.html?path=73.0.3683.68/ download according to your OS and download it in ~/Downloads .
then in open terminal in the ~/Downloads folder.
then USER#DESKTOP:~/Downloads$ unzip ~/Downloads/chromedriver_linux64.zip -d ~/Downloads You will get the raw chromedriver file in ~/Downloads folder.
now i moved the ChromeDriver 73.0.3683.68 file to two places - usr/local/bin and usr/bin in my system.
there was already a chromedriver file in usr/local/bin .
to move the file - USER#DESKTOP:~/Downloads$ sudo mv -f ~/Downloads/chromedriver /usr/local/bin/chromedriver and USER#DESKTOP:~/Downloads$ sudo mv -f ~/Downloads/chromedriver /usr/bin/chromedriver you are saying you want to move the file chromedriver from first location to other means replacing any files already in those locations with same name.
Last all i did was. close the vscode and relaunched it. and ran my code node library.js . and it worked it the chrome browser for me.
TOOK AN HOUR FOR ME TO GO THROUGH AROUND 35-40 STACK-OVERFLOW AND RANDOM ONLINE RESOURCES/QUESTION-ANSWERS BUT WAS WORTH IT. :)
SOURCE CODE : LIBRARY.JS
var webdriver = require('selenium-webdriver');
var By = webdriver.By;
var until = webdriver.until;
var driver = new webdriver.Builder().forBrowser('chrome').build();
driver.get('https://www.google.com');
Add this as a script to your package.json file
"scripts": {
"protactorInstall": "cd ./node_modules/protractor && npm i webdriver-manager#latest"}
use
npm run protactorInstall
to execute the script.
Try the below command from terminal to install particular version
webdriver-manager update --versions.chrome 2.46
Hope it helps you

Selenium shows java.net.SocketException: Connection reset

I have searched for the solution but I have not found the solution I always get this error
codigo :
public static void main(String [] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Ofima\\workspace\\OfimaWeb\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.get("http://ofimawebbeta.ofima.com/");
driver.manage().window().maximize();
driver.getTitle();
}
Error :
Starting ChromeDriver (v2.9.248315) on port 41785
ene 19, 2018 9:48:49 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMACIÓN: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Build info: version: '3.8.0', revision: '924c4067df', time: '2017-11-30T11:37:19.049Z'
System info: host: 'PCPOF-021', ip: '10.72.4.128', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)
at OfimaWeb.cartera.main(cartera.java:23)
Caused by: java.net.SocketException: Connection reset
The error does gives us some hint as follows :
org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Which essentially implies that ChromeDriver binary is unable to spawn a new Chrome Browser process.
Your main issue is the version compatibility among the binaries you are using as follows:
You are using ChromeDriver v2.9 (released 2014-01-31)
Release Notes of ChromeDriver v2.9_ clearly mentions the following :
Supports Chrome v31-34
You mentioned of using latest Chrome. I suppose it is chrome=65.x
You are using Selenium Version 3.8.0 (released 2017-11-30T11:37:19.049Z) [as per the error stack trace within your question]
So there is a clear mismatch between requirement for ChromeDriver v2.9 and the Chrome Browser version you are using. Hence ChromeDriver is unable to spawn the new Chrome Browser process.
Solution
Update ChromeDriver to current v2.35 level.
Downgrade Chrome to stable Chrome v64.x levels. (as per ChromeDriver v2.35 release notes)
Upgrade Selenium to current levels Version 3.8.1.
Clean and Re-Build your project through your IDE.
Clear the Browser Cache
Use CCleaner tool to wipe off all the OS chores.
If your Web Browser base version is too old, uninstall the Web Browser through Revo Uninstaller with Moderate Scan and install a recent GA Released version of the Web Browser.
Execute your #Test.
Download ChromeDriver from
http://chromedriver.storage.googleapis.com/index.html?path=2.33/
This ChromeDriver shall work with your version of Google Chrome.