selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80 - selenium

when i go to command prompt and type chromedriver -v:
ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945#{#614})
but when i try to run this code :
from selenium import webdriver
class InstaBot:
def __init__(self):
self.driver=webdriver.Chrome()
self.driver.get("www.instagram.com")
InstaBot()
it gives me error like this:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80
why this is happening i tried to remove selenium as well as chromedriver
and reinstall of version 79.0.3945 but when i run it ,it show this can only be run on version 80
my chrome version is 79.0.3945 which is lastest ,and version 80 chrome is chrome beta

This error message...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80
...implies that the ChromeDriver v80.0 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 mentioned about using chromedriver=79.0.3945.36 and the release notes of chromedriver=79.0 clearly mentions the following :
Supports Chrome v79
Presumably you are using chrome v79.0 browser.
So, it's quite evident your have chromedriver=80.0 present within your system which is also within the system PATH variable and is invoked while you:
self.driver=webdriver.Chrome()
Solution
There are two solutions:
Either you upgrade chrome to Chrome Version 80.0 level. (as per ChromeDriver v80.0 release notes)
Or you can override the default chromedriver v80.0 binary location with chromedriver v79.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/')
You can find a detailed discussion in Ubuntu: selenium.common.exceptions: session not created: This version of ChromeDriver only supports Chrome version 79
Additional Considerations
Ensure to:
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.
Reference
You can find a relevant detailed discussion in:
How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium

Use Bonigarcia plugin in project. After that it will manage all driver by itself.It reads chrome version and instantiate driver accordingly.
for help follow my post :
https://www.linkedin.com/pulse/webdrivermanager-bonigarcia-rohan-ravi-yadav/
or original git link/post
https://github.com/bonigarcia/webdrivermanager
If any help required , Let me know

Related

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

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

InvalidOperationException: session not created: This version of ChromeDriver only supports Chrome version 76 with ChromeDriver Selenium in AzureDevOPS

I have Ux Automation test project where in I am using the NuGet for Selenium.Chrome.WebDriver. The Agent in the release pipeline has below versions of chrome & WebDriver
Google Chrome
version:
75.0.3770.100
Selenium Web Drivers
Chrome Driver
version:
75.0.3770.90
Environment:
ChromeWebDriver: location of chromedriver.exe
I have tried check-in the project with 75 & 76 NuGet reference. However, I am getting below error in both cases.
System.InvalidOperationException: session not created: This version of ChromeDriver only supports Chrome version 76 (SessionNotCreated)
Which version it is complaining for?
This error message...
System.InvalidOperationException: session not created: This version of ChromeDriver only supports Chrome version 76 (SessionNotCreated)
...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:
Though you mentioned about using chromedriver=75.0.3770.90 there may be multiple instances of chromedriver being present in your system and the the version of the chromedriver which is effective in your tests is chromedriver=76.0
Release Notes of chromedriver=76.0 clearly mentions the following :
Supports Chrome version 76
Presumably you are using chrome= 75.0.
Release Notes of ChromeDriver v75.0 clearly mentions the following :
Supports Chrome 75
So there is a clear mismatch between the ChromeDriver v76.0 and the Chrome Browser v75.0
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v79.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.
Reference
You can find a relevant detailed discussion in:
How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium

HOOK-ERROR in after_step: TimeoutException: Message: timeout

Sometimes, when my script is run by jenkins i get an error:
HOOK-ERROR in after_step: TimeoutException: Message: timeout
(Session info: chrome=69.0.3497.92)
(Driver info: chromedriver=2.35.528139
(47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.4.0-128-generic x86_64)
i cannot reproduce this situation on my local machine. Do you have any idea how can i check and fix it?
This error message...
HOOK-ERROR in after_step: TimeoutException: Message: timeout
(Session info: chrome=69.0.3497.92)
(Driver info: chromedriver=2.35.528139
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser 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.35
Release Notes of chromedriver=2.35 clearly mentions the following :
Supports Chrome v62-64
You are using chrome=69.0
Release Notes of ChromeDriver v2.43 clearly mentions the following :
Supports Chrome v69-71
So there is a clear mismatch between the ChromeDriver v2.35 and the Chrome Browser v69.0
Solution
Upgrade JDK to recent levels JDK 8u191.
Upgrade Selenium to current levels Version 3.14.0.
Upgrade ChromeDriver to current ChromeDriver v2.42 level.
Keep Chrome version between Chrome v69-71 levels. (as per ChromeDriver v2.43 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 through Revo Uninstaller and install a recent GA and released version of Web Client.
Execute your #Test.

Only local connections are allowed Chrome and Selenium webdriver

I am using Chrome webdriver 2.23 & Selenium 2.53.1.
I have tried a lot, but could not get it fixed. Whenever I run my selenium script, it is giving me the following error
Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 12162
Only local connections are allowed.
This is just an informational message. Your issue might be a missmatch between the versions of chromedriver and selenium-server-standalone.
Try with the latest selenium version 3.0, it is working for me.
Please not that for selenium 3.0 you need to specify the driver first and after the selenium server.
With the new selenium, which is 3.0 you should use:
java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium-server-standalone-3.0.0-beta2.jar
If you are using selenium version below 3.0 you need to reverse the order of selenium with the driver, like:
java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium_server.jar
When you are starting the selenium server, open a console in the directory with chromedriver and selenium server and execute the above command.
Here you are a working stack:
Some previous notes:
If you run selenium in a non graphical enviromnent, xvfb is required.
You will need selenium-server-standalone-2.53.1.jar (working version). You can download selenium versions here: http://selenium-release.storage.googleapis.com/index.html
You will also need chromedriver v 2.27. Download link: https://chromedriver.storage.googleapis.com/index.html
1) Run sudo Xvfb :10 -ac &
2) Run export DISPLAY=:10
3) Run java -jar "YOUR_PATH_TO/selenium-server-standalone-2.53.1.jar" -Dwebdriver.chrome.driver="YOUR_PATH_TO/chromedriver.2.27" -Dwebdriver.chrome.whitelistedIps="localhost"
First off, What you are seeing is not an error. It is an informational message.
When you run this driver, it will enable your scripts to access this and run commands on Google Chrome.
This can be done via scripts running in the local network (Only local connections are allowed.) or via scripts running on outside networks (All remote connections are allowed.). It is always safer to use the Local Connection option. By default your Chromedriver is accessible via port 9515.
See this answer if you wish to allow all connections instead of just local.
If your Chromedriver only shows the above two messages (as per the question), then there is a problem. It has to show a message like this, which says it started successfully.
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103#{#416}) 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.
To troubleshoot this...
Step 1: Check your Chromedriver version
$ chromedriver --version
ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103#{#416})
My version is 83.0.4103.39.
Step 2: Check your Chrome Browser version
Open Google Chrome.
Options --> Help --> About Google Chrome
Or open a terminal and run the following command (works on Ubuntu).
$ google-chrome --version
Google Chrome 83.0.4103.61
My version is: Version 83.0.4103.61
Step 3: Compare versions of Chromedriver and Google Chrome
Both these versions are starting with 83, which means they are both compatible. Hence, you should see a message like below, when you run the below command.
$ chromedriver
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103#{#416}) 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.
If your versions mismatch, then you will see the following message. You will not see the line which says, ChromeDriver was started successfully..
$ chromedriver
Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987#{#882}) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Step 4: Download the correct version of Chromedriver
Download the correct version that matches your browser version. Use this page for downloads. After you download, extract the content, and move it to one of the following two folders. Open each of the following two folders and see whether your current Chromedriver is there. If it is on both folders, replace both. And do STEP 3 again.
/usr/bin/chromedriver
/usr/local/bin/chromedriver
Check the version of your installed Chrome browser.
Download the compatible version of ChromeDriver from
https://sites.google.com/a/chromium.org/chromedriver/
Set the location of the compatible ChromeDriver to:
System.setProperty("webdriver.chrome.driver", "C:\\Users\\your_path\\chromedriver.exe");
Run the Test again.
It should be good now.
You need to pass --whitelisted-ips= into chrome driver (not chrome!). If you use ChromeDriver locally/directly (not using RemoteWebDriver) from code, it shouldn't be your problem.
If you use it remotely (eg. selenium hub/grid) you need to set system property when node starts, like in command:
java -Dwebdriver.chrome.whitelistedIps= testClass etc...
or docker by passing JAVA_OPTS env
chrome:
image: selenium/node-chrome:3.141.59
container_name: chrome
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
- JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=
I followed my frnd suggestion and it worked like a gem for me:
Working Code:
1) Downloaded chromedriver.
2) Code is
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Sel {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Downloads\\chromedriver_win32\\chromedriver.exe"); // path of chromedriver
WebDriver driver = new ChromeDriver();
driver.get("https://google.ca");
driver.manage().window().maximize();
driver.getTitle();
}
}
For me, updating the chromedriver and selenium version removed this message.
However, this is not an actual error and just an informational message.
If your program is still passing with exit code 0 at the end even when this message is printed, it means the execution went fine.
I was able to resolve the problem by following steps:
a. upgrade to the latest chrome version, clear the cache and close the chrome browser
b. Download latest Selenium 3.0
C#:
ChromeOptions options = new ChromeOptions();
options.AddArgument("C:/Users/username/Documents/Visual Studio 2012/Projects/Interaris.Test/Interaris.Tes/bin/Debug/chromedriver.exe");
ChromeDriver chrome = new ChromeDriver(options);
Worked for me.
Sorry for late post but still for info,I also facing same problem so I Used updated version of chromedriver ie.2.28 for updated chrome browser ie. 55 to 57 which resolved my problem.
I was also getting the same issue. I resolved this issue by updating the chromedriver. So if anyone is facing same issue with chrome browser just update your chromedriver.
I saw this error
Only local connections are allowed
And I updated both the selenium webdriver, and the google-chrome-stable package
webdriver-manager update
zypper install google-chrome-stable
This site reports the latest version of the chrome driver
https://sites.google.com/a/chromium.org/chromedriver/
My working versions are chromedriver 2.41 and google-chrome-stable 68