Message: session not created: This version of ChromeDriver only supports Chrome version 94 Current browser version is 93.0.4577.82 - selenium

Writing a simple selenium script to click on links on aa website. The script is written like so:
from selenium import webdriver
import time
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)
try:
browser.get("https://www.google.com")
print("Page title was '{}'".format(browser.title))
finally:
browser.quit()
Now the issue is the actual chrome driver itself I get the following exception
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 94
Current browser version is 93.0.4577.82 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
I went to the chromedriver downloads site. I still get the same error though.

Compatibility issue.
Your chrome driver version is 94.0.4606.41 and this driver version supports Chrome browser 94
Please do anyone of the following.
Update the chrome browser version to 94
Degrade the driver version to 93 (Download 93 version from here https://chromedriver.storage.googleapis.com/index.html?path=93.0.4577.63/)

This error occurred because you have different versions of Google Chrome and driver. It is better to update the driver, rather than install the old version of Google, since in the future it will be constantly updated (why do you want to use outdated technologies?).
I usually use :
ChromeDriverManager
because at any time without going to the web driver website you can simply download the driver with the following command:
driver = webdriver.Chrome(ChromeDriverManager().install())
Further, using the path given by this command, you can use the freshly installed version:
driver = webdriver.Chrome(executable_path=r"C:\path_to_chrome_driver_executable\chromedriver.exe")

This made me go crazy I solved it like this we are using selenium npm module.
Run the code below and it will tell you what executable path you are using.
const { Builder, By, Key, util } = require("selenium-webdriver");
const chrome = require("selenium-webdriver/chrome");
console.log(chrome.getDefaultService().executable_);
I had installed chromedriver globally
npm i chromedriver -g
The executable path showed me it was using this and an older version.
Uninstalled this.
npm uninstall chromedriver -g
Now it started using the version I dowloaded and added to me PATH.
Download the latest chromedriver from here.
https://chromedriver.chromium.org/downloads
Add it to your path in the .zshrc file.
export PATH=/Users/dave/SeleniumWebdrivers:$PATH
Drag your downloaded drivers into this folder.

If you're using Mac run
brew reinstall chromedriver

I think there is another way to solve this problem. Uninstall the protarctor and reinstall it and see magic.
npm uninstall protractor
npm install protractor
Session not created: This version of ChromeDriver only supports

Related

Selenium - This version of ChromeDriver only supports Chrome version xx

Suddenly today all my tests stopped working, giving me following error message:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 97
Current browser version is 99.0.4844.51 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
I have not updated the browser (auto-update is disabled) before the error occurred, i haven't changed anything at all. I have now downloaded Version 99.0.4844.51 of both the browser as well as driver but I still get the very same error.
I've tried every solution i could find on here and the internet (although most were just "update your stuff") but nothing has worked.
go to https://chromedriver.chromium.org/ and download the latest stable version of chromedriver and download it in your project folder.
As of September 2022, the following solution worked for me on an M1 Macbook.
Uninstall the Chrome browser
Then uninstall chromedriver brew uninstall --cask chromedriver
Re-install the Chrome browser
Then re-install the chromedriver brew install --cask chromedriver
I had the same issue, chromedriver stays linked for old version of chromedriver even if new version was updated. Try to use instructions below, for me it was helpful:
Go to manage nuGet packages..
then go to browse tab and search the package with keyword: "Selenium.Chrome.WebDriver" (For other browser, install corresponding package)
and then install it. (Note: if it is already installed then remove the package before installing it.)
update your chrome driver from here: http://chromedriver.chromium.org/downloads and save it to your local machine and give the path of it into your code.(var driver = new ChromeDriver(#"C:\Libraries");)
You should see your version on your chrome navigator and use the same. Help/ About and see the version.
I had the same problem, to fix it you need to verify if your Google Chrome version is updated.
Open Google Chrome and go to settings
[image1]: https://i.stack.imgur.com/GzOzy.png
Verify your Google Chrome version
[image2] https://i.stack.imgur.com/o2Vmn.png
Update your chrome version
[image3]: https://i.stack.imgur.com/dsZNd.png
And run again your test

Fitnesse Browser tests , configuration for pointing to Chrome Binary in Linux [duplicate]

For compatibility reasons I prefer to use Chrome version 55.0.2883.75 with Chromedriver v. 2.26. I downloaded the older version of chrome from https://www.slimjet.com/chrome/google-chrome-old-version.php and Chromedriver 2.26 from https://chromedriver.storage.googleapis.com/index.html?path=2.26/.
I am using the following code to attempt to set my Chrome binary location:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = "C:\\Program Files\\Chrome\\chrome64_55.0.2883.75\\chrome.exe"
driver = webdriver.Chrome('chromedriver.exe', chrome_options = options)
However, when I attempt to launch the WebDriver Python returns the following error:
WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.26.436362
(5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.14393 x86_64)
I have tried searching through similar questions and answers but have not had any luck so far. Any help is greatly appreciated - thank you in advance!
This error message...
WebDriverException: unknown error: cannot find Chrome binary
...implies that the ChromeDriver was unable to find the Chrome binary in the default location for your system.
As per the ChromeDriver - Requirements:
The server expects you to have Chrome installed in the default location for each system:
OS
Expected Location of Chrome
Linux
/usr/bin/google-chrome1
Mac
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
Windows XP
%HOMEPATH%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe
Windows Vista and newer
C:\Users%USERNAME%\AppData\Local\Google\Chrome\Application\chrome.exe
1 For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary.
Using a Chrome executable in a non-standard location
However you can also override the default Chrome binary location as follows:
To use Chrome version 55.x installed in non standard location through ChromeDriver v2.26 you can use the following code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = "C:\\Program Files\\Chrome\\chrome64_55.0.2883.75\\chrome.exe"
driver = webdriver.Chrome(chrome_options = options, executable_path=r'C:\path\to\chromedriver.exe')
driver.get('http://google.com/')
print("Chrome Browser Invoked")
driver.quit()
Related Docs
Reference
You can find a detailed discussion in:
Is Chrome installation needed or only chromedriver when using Selenium?
What happened to me is that I didn't have chrome, the main browser, installed.
Download the browser and it fixes this issue.
Using an old version of chrome driver with the latest Google Chrome locally gave me the same exception.
Just go to the ChromeDriver page and make sure you have the latest version.
I faced similar issue in MacOS. Even after setting binary path in chromeoptions, it didn't work. It got fixed after installing npm i chromedriver
It is also important to download Chrome from the actual website. I ran into the same problem, but I had downloaded Chrome from the Ubuntu software package manager. I uninstalled the package manager version and installed from the website, and the error resolved. Same issue could probably arise installing from other package managers.
Check https://sites.google.com/a/chromium.org/chromedriver/getting-started
You can specify the binary path in the constructor of the webdriver:
driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
I did this to solve my problem
private WebDriver driver;
#Before
public void StartBrowser() {
System.setProperty("webdriver.chrome.driver", "C://opt//WebDriver//bin//chromedriver.exe");
driver = new ChromeDriver();
driver.get("https://www.saucedemo.com/");}
I have solved this problem by installing Google Chrome link and it solved problem automatically (I use Kali Linux) and be sure that it is installed to the "/usr/bin"(default it is downloaded to here).

Using selenium-chrome-driver 4.0.0-alpha-5 and I'm getting this error: "This version of ChromeDriver only supports Chrome version 81" [duplicate]

I am currently new to robot framework.I am currently using latest window version of chrome and chromedriver which is 80 but when i try to run the test it gives the message "SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81" in pycharm but currently beta version of 81 is only available. I have tried uninstalling everthing and reinstalling it again but nothing works can anyone help me with this.Thank you!
Screenshots below:
I solved these kinds of problems using the webdrive manager.
You can automatically use the correct chromedriver by using the webdrive-manager.
Install the webdrive-manager:
pip install webdriver-manager
Then use the driver in python as follows
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
This answer is taken from https://stackoverflow.com/a/52878725
Do below steps :
Check the version of chrome browser.
download chromedriver of same version from https://sites.google.com/chromium.org/driver/home
Give correct path in the pycharm and run the code.
I got the same message on MacOS:
"selenium.common.exceptions.SessionNotCreatedException: Message:
session not created: This version of ChromeDriver only supports Chrome
version 81"
Then I run this command, it's gone:
# Homebrew 3
brew upgrade chromedriver
# Homebrew < 3
brew cask upgrade chromedriver
This error message...
SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81
...implies that the ChromeDriver v81 was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser where is version is other then 81.0.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You mentioned about using chromedriver=80 and chrome=80 but somehow while your program execution ChromeDriver v 81.0 is used.
So, it's quite evident your have chromedriver=81.0 present within your system and is present within the system PATH variable which gets invoked while you:
driver = webdriver.Chrome()
Solution
There are two solutions:
Either you upgrade chrome to Chrome Version 81.0 level. (as per ChromeDriver v81.0 release notes)
Or you can override the default chromedriver v81.0 binary location with chromedriver v80.0 binary location as follows:
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe')
driver.get('http://google.com/')
Reference
You can find a couple of relevant discussions in:
How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80
Ubuntu: selenium.common.exceptions: session not created: This version of ChromeDriver only supports Chrome version 79
First of all check latest Chrome version (This is your browser Chrome version) link
Download same version of Chrome Web Driver from this link
Do not download latest Chrome Web Driver if it does not match your Chrome Browser version.
Note: When I write this message, latest Chrome Browser version is 84 but latest Chrome Driver version is 85. I am using Chrome Driver version 84 so that Chrome Driver and Chrome Browser versions are the same.
Go to your Chrome settings -> About Chrome -> Check version
and download chromedriver from Below according to your Chrome version
https://chromedriver.chromium.org/downloads
this works for me
brew cask upgrade chromedriver
Above is deprecated on MacOs, use:
brew install chromedriver (if not already installed)
brew upgrade chromedriver
Chrome version is updating everyday so you need use exact chromedriver version according chrome version
https://chromedriver.chromium.org/downloads in this website you can download chromedrivers
The solution (at least on OSX) is:
Download the latest chromedriver file.
Unzip the downloaded file.
Search the location of the old chromedriver file on your computer and replace it with the new chromedriver file.
Right-click the chromedriver file and click open. Do not double click as Mac will not open it the proper way.
Once the file runs for the first time, you can close it and the update will have taken place.
Your Chrome Driver version needs to match your Chrome Browser version
Get you Chrome Browser version, by typing chrome://version
enter image description here
Download Chrome Driver version that matches you Chrome Browser version, form this website
https://chromedriver.chromium.org/downloads
If you are getting this error when you run stuffs on automated cluster and you are downloading the stable version of the google chrome every time then you can use the below shell script to download the compatible version of the chrome driver dynamically every time even if the stable version of the chrome gets updated.
%sh
#downloading compatible chrome driver version
#getting the current chrome browser version
**chromeVersion=$(google-chrome --product-version)**
#getting the major version value from the full version
**chromeMajorVersion=${chromeVersion%%.*}**
# setting the base url for getting the release url for the chrome driver
**baseDriverLatestReleaseURL=https://chromedriver.storage.googleapis.com/LATEST_RELEASE_**
#creating the latest release driver url based on the major version of the chrome
**latestDriverReleaseURL=$baseDriverLatestReleaseURL$chromeMajorVersion**
**echo $latestDriverReleaseURL**
#file name of the file that gets downloaded which would contain the full version of the chrome driver to download
**latestDriverVersionFileName="LATEST_RELEASE_"$chromeMajorVersion**
#downloading the file that would contain the full release version compatible with the major release of the chrome browser version
**wget $latestDriverReleaseURL**
#reading the file to get the version of the chrome driver that we should download
**latestFullDriverVersion=$(cat $latestDriverVersionFileName)**
**echo $latestFullDriverVersion**
#creating the final URL by passing the compatible version of the chrome driver that we should download
**finalURL="https://chromedriver.storage.googleapis.com/"$latestFullDriverVersion"/chromedriver_linux64.zip"**
**echo $finalURL**
**wget $finalURL**
I was able to get the compatible version of chrome browser and chrome driver using the above approach when running scheduled job on the databricks environment and it worked like a charm without any issues.
Hope it helps others in one way or other.
With Laravel (PHP) you can fix this with:
php artisan dusk:install
It will download and install the new driver.
Documentation: https://laravel.com/docs/9.x/dusk#installation
The case when your Chrome is in the middle of its update also causes this exception. In my case chromedriver was already updated, while the chrome itself was v81 instead of v83.
You can also download the correct chromedriver version from:
https://chromedriver.chromium.org/downloads
https://chromedriver.storage.googleapis.com/index.html?path=81.0.4044.138/
I too had a similar problem. And I've got a solution .. Download the matching chromedriver, and place the chromedriver under the /usr/local/bin path. It works.
The way I solved this issue was quite simple, I checked my chrome version and I had an older chromedriver in my PATH variable, so I downloaded the chromedriver version that matched my browser and replaced the old one in the PATH, so when the webdriver module looked for a chromedriver in my PATH, it would find the matching version
I had already been running a local server at the same port the session wanted to run on, and this caused the error. Shutting down that local server fixed this for me.
You need to install webdriver manager. Make sure webdriver manager it is also updated.
If you use npm:
npm install -g webdriver-manager
webdriver-manager update
If you're getting this error in Visual Studio 2019 and using Selenium.WebDriver.ChromeDriver by jsakamoto, check the version you're referencing in the packages.config file.
<package id="Selenium.WebDriver.ChromeDriver" version="89.0.4389.2300" targetFramework="net45" />
Update your NuGet package to the appropriate version and resolve the issue.
I resolved this issue by simply running Firefox (geckodriver) instead of Chrome:
rsDriver(browser = "firefox")
I got this error after a recent chrome upgrade, and also I recently updated my Mac to Big Sur. Seems cask is not part of brew command, need to use it separately.
brew install --cask chromedriver
You can handle this exception
from selenium.common.exceptions import SessionNotCreatedException
Add this function
def update_chrome():
try:
print("Updating chrome driver")
download_chrome = "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
unpack_chrome = "sudo dpkg -i google-chrome-stable_current_amd64.deb"
install_chrome = "sudo apt-get -f install"
file_path = os.path.join(os.environ['HOME'], "google-chrome-stable_current_amd64.deb")
if os.path.isfile(file_path):
print("{} found\nremoving {}".format(file_path, file_path))
os.remove(file_path)
else:
print("File does not exist {}".format(file_path))
old_chrome_ver = os.popen("/usr/bin/google-chrome --version").read().strip('Google Chrome ').strip().split(".")[0]
print("Current Chrome version: {}".format(old_chrome_ver))
os.system(command=download_chrome)
sleep(2)
os.system(command=unpack_chrome)
sleep(5)
os.system(command=install_chrome)
crnt_chrome_ver = os.popen("/usr/bin/google-chrome --version").read().strip('Google Chrome ').strip().split(".")[0]
print("Current Chrome version: {}".format(crnt_chrome_ver))
if crnt_chrome_ver == old_chrome_ver:
print("Chrome version is same as before")
elif crnt_chrome_ver > old_chrome_ver:
print("Chrome version is updated from {} to {}".format(old_chrome_ver, crnt_chrome_ver))
return True
except Exception as e:
print("Error while updating chrome: {}".format(e))
return False
then call this function
try:
# Your code here
except SessionNotCreatedException as snce:
print("Session not created: {}".format(snce))
chrome_update_result = False
if recurrences == 0:
chrome_update_result = update_chrome()
if chrome_update_result:
recurrences += 1
print("Chrome updated successfully")
erisapedia_bot(state, download_dir)
return True
else:
print("Chrome update failed")
return False
What worked for me is this command:
pip install chromedriver-binary==your_chrome_version
This will uninstall the current chrome-driver that you have installed and will install a chrome-driver that matches your chrome version.
The solution is:-
Check out the chrome version of your chrome.From chrome://settings/help
Check out which version of ChromeDriver is compatible with your current
chrome version from here
download the compatible one and replace the existing ChromeDriver with
a new ChromeDriver.
Now run the code
It didn't feel like folks were answering the issue here which is: being on the latest version of beta Chrome/Chromium and not seeing the matching chromedriver version
For example, currently as of writing this, Chromium for Mac is Version 86.0.4190.0 (Developer Build) (64-bit) however the latest chromedriver versions listed are
Current stable release: ChromeDriver 83.0.4103.39
Current beta release: ChromeDriver 84.0.4147.30
If you go to https://chromedriver.chromium.org/downloads/version-selection, they provide some pointers on getting a compatible version. One of the last lines near the end mentions trying the ChromeDriver Canary build which leads to how to get it from Chromium browser snapshots.
Of course this goes without saying that using the latest experimental version is likely to have bugs
I faced this problem even after using webdriver manager. I was able to resolve the issue after specifying the exact version of chromedriver that I needed in the webddriver manager.
I was using chrome version 84 and the webdriver manager was installing the latest version of chromedriver, which was 85.0.4183.38.
I made webdriver manager to open the chromedriver version 84.0.4147.30 by writing the following command.
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager(84.0.4147.30).install())
Referring to #dylanvanw answer. You might still out of luck. I found that you might have a different path that you have installed Python. In my case, I have to move Chromedriver.exe from the cache path (C:\Users\Poom.wdm\drivers\chromedriver\win32\84.0.4147.30) to C:\Python38 then it work!
Steps I took to make it work
Check your current Chrome version e.g. 81
Goto tools/nuget package manager
Select selenium chrome driver
upgrade/downgrade to the same Chrome-version you have.
Restarting the application should work.
I found a workaround to download latest version of ChromeDriver via WebDriverManager
You could try something like,
WebDriver driver = null ;
boolean oldVersion = true;
String chromeVersion = "";
try {
try{
FileReader reader = new FileReader("chromeVersion.txt") ;
BufferedReader br = new BufferedReader(reader) ;
String line;
while ((line = br.readLine()) != null){
chromeVersion = line.trim();
}
reader.close();
} catch (IOException e ) {}
WebDriverManager.chromedriver().version(chromeVersion).setup();
driver = new ChromeDriver() ;
} catch (Exception e) {
oldVersion = false;
String err = e.getMessage() ;
chromeVersion = err.split("version is")[1].split("with binary path")[0].trim();
try{
FileWriter writer = new FileWriter("chromeVersion.txt", true) ;
writer.write(chromeVersion) ;
writer.close();
} catch (IOException er ) {}
}
if (!oldVersion){
WebDriverManager.chromedriver().version(chromeVersion).setup();
driver = new ChromeDriver() ;
}
driver.get("https://www.google.com") ;
I got this error when the chrome driver was not closed properly. Eg, if I try to find something and click it and it doesn't exist, the driver throws an exception and the thread ended there ( I did not close the driver ).
So, when I ran the same method again later where I had to reinitialize the driver, the driver didn't initialize and it threw the exception.
My solve was simply to wrap the selenium tasks in a try catch and close the driver properly

Selenium Error: This version of ChromeDriver only supports Chrome version 81 | My driver version is 81.0.4044.69

Getting this error when trying to launch headed selenium session.
command I used was
driver = webdriver.Chrome(executable_path=r'C:\Users\Administrator\Desktop\chromedriver\chromedriver.exe')
Please downgrade to Chromedriver 80 (which is stable version). Chromedriver 81 is still beta version and it supports chrome 81, I am sure you might have Chrome browser version 80.
You can download chrome 80 stable version from here
Edit 1: Recommended
Alternatively you can use webdriver-manager which will take care of installing the latest driver on the fly. So you don't have to worry, each time when your browser get's updated/ newer version of driver is available.
Here is how you can install the webdriver-manager using pip.
pip install webdriver-manager
Once the webdriver_manage is installed successfully you can start using it in the script as shown below.
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get("https://www.google.com")
driver.quit
The great part with this library is you can install any driver on the fly.

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

I am currently new to robot framework.I am currently using latest window version of chrome and chromedriver which is 80 but when i try to run the test it gives the message "SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81" in pycharm but currently beta version of 81 is only available. I have tried uninstalling everthing and reinstalling it again but nothing works can anyone help me with this.Thank you!
Screenshots below:
I solved these kinds of problems using the webdrive manager.
You can automatically use the correct chromedriver by using the webdrive-manager.
Install the webdrive-manager:
pip install webdriver-manager
Then use the driver in python as follows
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
This answer is taken from https://stackoverflow.com/a/52878725
Do below steps :
Check the version of chrome browser.
download chromedriver of same version from https://sites.google.com/chromium.org/driver/home
Give correct path in the pycharm and run the code.
I got the same message on MacOS:
"selenium.common.exceptions.SessionNotCreatedException: Message:
session not created: This version of ChromeDriver only supports Chrome
version 81"
Then I run this command, it's gone:
# Homebrew 3
brew upgrade chromedriver
# Homebrew < 3
brew cask upgrade chromedriver
This error message...
SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81
...implies that the ChromeDriver v81 was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser where is version is other then 81.0.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You mentioned about using chromedriver=80 and chrome=80 but somehow while your program execution ChromeDriver v 81.0 is used.
So, it's quite evident your have chromedriver=81.0 present within your system and is present within the system PATH variable which gets invoked while you:
driver = webdriver.Chrome()
Solution
There are two solutions:
Either you upgrade chrome to Chrome Version 81.0 level. (as per ChromeDriver v81.0 release notes)
Or you can override the default chromedriver v81.0 binary location with chromedriver v80.0 binary location as follows:
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe')
driver.get('http://google.com/')
Reference
You can find a couple of relevant discussions in:
How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80
Ubuntu: selenium.common.exceptions: session not created: This version of ChromeDriver only supports Chrome version 79
First of all check latest Chrome version (This is your browser Chrome version) link
Download same version of Chrome Web Driver from this link
Do not download latest Chrome Web Driver if it does not match your Chrome Browser version.
Note: When I write this message, latest Chrome Browser version is 84 but latest Chrome Driver version is 85. I am using Chrome Driver version 84 so that Chrome Driver and Chrome Browser versions are the same.
Go to your Chrome settings -> About Chrome -> Check version
and download chromedriver from Below according to your Chrome version
https://chromedriver.chromium.org/downloads
this works for me
brew cask upgrade chromedriver
Above is deprecated on MacOs, use:
brew install chromedriver (if not already installed)
brew upgrade chromedriver
Chrome version is updating everyday so you need use exact chromedriver version according chrome version
https://chromedriver.chromium.org/downloads in this website you can download chromedrivers
The solution (at least on OSX) is:
Download the latest chromedriver file.
Unzip the downloaded file.
Search the location of the old chromedriver file on your computer and replace it with the new chromedriver file.
Right-click the chromedriver file and click open. Do not double click as Mac will not open it the proper way.
Once the file runs for the first time, you can close it and the update will have taken place.
Your Chrome Driver version needs to match your Chrome Browser version
Get you Chrome Browser version, by typing chrome://version
enter image description here
Download Chrome Driver version that matches you Chrome Browser version, form this website
https://chromedriver.chromium.org/downloads
If you are getting this error when you run stuffs on automated cluster and you are downloading the stable version of the google chrome every time then you can use the below shell script to download the compatible version of the chrome driver dynamically every time even if the stable version of the chrome gets updated.
%sh
#downloading compatible chrome driver version
#getting the current chrome browser version
**chromeVersion=$(google-chrome --product-version)**
#getting the major version value from the full version
**chromeMajorVersion=${chromeVersion%%.*}**
# setting the base url for getting the release url for the chrome driver
**baseDriverLatestReleaseURL=https://chromedriver.storage.googleapis.com/LATEST_RELEASE_**
#creating the latest release driver url based on the major version of the chrome
**latestDriverReleaseURL=$baseDriverLatestReleaseURL$chromeMajorVersion**
**echo $latestDriverReleaseURL**
#file name of the file that gets downloaded which would contain the full version of the chrome driver to download
**latestDriverVersionFileName="LATEST_RELEASE_"$chromeMajorVersion**
#downloading the file that would contain the full release version compatible with the major release of the chrome browser version
**wget $latestDriverReleaseURL**
#reading the file to get the version of the chrome driver that we should download
**latestFullDriverVersion=$(cat $latestDriverVersionFileName)**
**echo $latestFullDriverVersion**
#creating the final URL by passing the compatible version of the chrome driver that we should download
**finalURL="https://chromedriver.storage.googleapis.com/"$latestFullDriverVersion"/chromedriver_linux64.zip"**
**echo $finalURL**
**wget $finalURL**
I was able to get the compatible version of chrome browser and chrome driver using the above approach when running scheduled job on the databricks environment and it worked like a charm without any issues.
Hope it helps others in one way or other.
With Laravel (PHP) you can fix this with:
php artisan dusk:install
It will download and install the new driver.
Documentation: https://laravel.com/docs/9.x/dusk#installation
The case when your Chrome is in the middle of its update also causes this exception. In my case chromedriver was already updated, while the chrome itself was v81 instead of v83.
You can also download the correct chromedriver version from:
https://chromedriver.chromium.org/downloads
https://chromedriver.storage.googleapis.com/index.html?path=81.0.4044.138/
I too had a similar problem. And I've got a solution .. Download the matching chromedriver, and place the chromedriver under the /usr/local/bin path. It works.
The way I solved this issue was quite simple, I checked my chrome version and I had an older chromedriver in my PATH variable, so I downloaded the chromedriver version that matched my browser and replaced the old one in the PATH, so when the webdriver module looked for a chromedriver in my PATH, it would find the matching version
I had already been running a local server at the same port the session wanted to run on, and this caused the error. Shutting down that local server fixed this for me.
You need to install webdriver manager. Make sure webdriver manager it is also updated.
If you use npm:
npm install -g webdriver-manager
webdriver-manager update
If you're getting this error in Visual Studio 2019 and using Selenium.WebDriver.ChromeDriver by jsakamoto, check the version you're referencing in the packages.config file.
<package id="Selenium.WebDriver.ChromeDriver" version="89.0.4389.2300" targetFramework="net45" />
Update your NuGet package to the appropriate version and resolve the issue.
I resolved this issue by simply running Firefox (geckodriver) instead of Chrome:
rsDriver(browser = "firefox")
I got this error after a recent chrome upgrade, and also I recently updated my Mac to Big Sur. Seems cask is not part of brew command, need to use it separately.
brew install --cask chromedriver
You can handle this exception
from selenium.common.exceptions import SessionNotCreatedException
Add this function
def update_chrome():
try:
print("Updating chrome driver")
download_chrome = "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
unpack_chrome = "sudo dpkg -i google-chrome-stable_current_amd64.deb"
install_chrome = "sudo apt-get -f install"
file_path = os.path.join(os.environ['HOME'], "google-chrome-stable_current_amd64.deb")
if os.path.isfile(file_path):
print("{} found\nremoving {}".format(file_path, file_path))
os.remove(file_path)
else:
print("File does not exist {}".format(file_path))
old_chrome_ver = os.popen("/usr/bin/google-chrome --version").read().strip('Google Chrome ').strip().split(".")[0]
print("Current Chrome version: {}".format(old_chrome_ver))
os.system(command=download_chrome)
sleep(2)
os.system(command=unpack_chrome)
sleep(5)
os.system(command=install_chrome)
crnt_chrome_ver = os.popen("/usr/bin/google-chrome --version").read().strip('Google Chrome ').strip().split(".")[0]
print("Current Chrome version: {}".format(crnt_chrome_ver))
if crnt_chrome_ver == old_chrome_ver:
print("Chrome version is same as before")
elif crnt_chrome_ver > old_chrome_ver:
print("Chrome version is updated from {} to {}".format(old_chrome_ver, crnt_chrome_ver))
return True
except Exception as e:
print("Error while updating chrome: {}".format(e))
return False
then call this function
try:
# Your code here
except SessionNotCreatedException as snce:
print("Session not created: {}".format(snce))
chrome_update_result = False
if recurrences == 0:
chrome_update_result = update_chrome()
if chrome_update_result:
recurrences += 1
print("Chrome updated successfully")
erisapedia_bot(state, download_dir)
return True
else:
print("Chrome update failed")
return False
What worked for me is this command:
pip install chromedriver-binary==your_chrome_version
This will uninstall the current chrome-driver that you have installed and will install a chrome-driver that matches your chrome version.
The solution is:-
Check out the chrome version of your chrome.From chrome://settings/help
Check out which version of ChromeDriver is compatible with your current
chrome version from here
download the compatible one and replace the existing ChromeDriver with
a new ChromeDriver.
Now run the code
It didn't feel like folks were answering the issue here which is: being on the latest version of beta Chrome/Chromium and not seeing the matching chromedriver version
For example, currently as of writing this, Chromium for Mac is Version 86.0.4190.0 (Developer Build) (64-bit) however the latest chromedriver versions listed are
Current stable release: ChromeDriver 83.0.4103.39
Current beta release: ChromeDriver 84.0.4147.30
If you go to https://chromedriver.chromium.org/downloads/version-selection, they provide some pointers on getting a compatible version. One of the last lines near the end mentions trying the ChromeDriver Canary build which leads to how to get it from Chromium browser snapshots.
Of course this goes without saying that using the latest experimental version is likely to have bugs
I faced this problem even after using webdriver manager. I was able to resolve the issue after specifying the exact version of chromedriver that I needed in the webddriver manager.
I was using chrome version 84 and the webdriver manager was installing the latest version of chromedriver, which was 85.0.4183.38.
I made webdriver manager to open the chromedriver version 84.0.4147.30 by writing the following command.
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager(84.0.4147.30).install())
Referring to #dylanvanw answer. You might still out of luck. I found that you might have a different path that you have installed Python. In my case, I have to move Chromedriver.exe from the cache path (C:\Users\Poom.wdm\drivers\chromedriver\win32\84.0.4147.30) to C:\Python38 then it work!
Steps I took to make it work
Check your current Chrome version e.g. 81
Goto tools/nuget package manager
Select selenium chrome driver
upgrade/downgrade to the same Chrome-version you have.
Restarting the application should work.
I found a workaround to download latest version of ChromeDriver via WebDriverManager
You could try something like,
WebDriver driver = null ;
boolean oldVersion = true;
String chromeVersion = "";
try {
try{
FileReader reader = new FileReader("chromeVersion.txt") ;
BufferedReader br = new BufferedReader(reader) ;
String line;
while ((line = br.readLine()) != null){
chromeVersion = line.trim();
}
reader.close();
} catch (IOException e ) {}
WebDriverManager.chromedriver().version(chromeVersion).setup();
driver = new ChromeDriver() ;
} catch (Exception e) {
oldVersion = false;
String err = e.getMessage() ;
chromeVersion = err.split("version is")[1].split("with binary path")[0].trim();
try{
FileWriter writer = new FileWriter("chromeVersion.txt", true) ;
writer.write(chromeVersion) ;
writer.close();
} catch (IOException er ) {}
}
if (!oldVersion){
WebDriverManager.chromedriver().version(chromeVersion).setup();
driver = new ChromeDriver() ;
}
driver.get("https://www.google.com") ;
I got this error when the chrome driver was not closed properly. Eg, if I try to find something and click it and it doesn't exist, the driver throws an exception and the thread ended there ( I did not close the driver ).
So, when I ran the same method again later where I had to reinitialize the driver, the driver didn't initialize and it threw the exception.
My solve was simply to wrap the selenium tasks in a try catch and close the driver properly