This error drives me crazy. My code is:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import chromedriver_binary
from selenium.webdriver.common.by import By
import time
from influxdb import InfluxDBClient
chrome_options = Options()
chrome_options.add_argument("--headless")
chromedriver_binary =
"/home/dario/scripts/cron_run/web_app_login_checker/chromedriver/chromedriver"
driver = webdriver.Chrome(chromedriver_binary, options=chrome_options)
If I do:
./chromedriver -v
ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-
heads/3945#{#614})
It's the right version.
Full traceback is:
Traceback (most recent call last):
File "grafana.py", line 12, in <module>
driver = webdriver.Chrome(chromedriver_binary, options=chrome_options)
File
"/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site-
packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File
"/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site-
packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File
"/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site-
packages/selenium/webdriver/remote/webdriver.py", line 252, in
start_session
response = self.execute(Command.NEW_SESSION, parameters)
File
"/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site-
packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File
"/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site-
packages/selenium/webdriver/remote/errorhandler.py", line 242, in
check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session
not created: This version of ChromeDriver only supports Chrome version
79
None of the already discussed topics here on Stack Overflow helped me.
The problem is the Chrome browser version, not the ChromeDriver version. You need to update it to version 79, or downgrade the ChromeDriver. You can find here the matching versions.
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. You could do something similar to this python to make it work.
%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.
Check your chrome version
Download the same version of the chrome driver
Check the latest driver here
Update your driver in the reference folder.
In my case, I am using the windows 10 and python I've updated with the latest chromedriver.exe file (for Chrome v83)
This error message...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 79
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser v79.x session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=79.0.3945.36
Release Notes of chromedriver=79.0.3945.36 clearly mentions the following :
Supports Chrome version 79
Presumably you are using the latest Version 78.0.3904.108 (Official Build)
So there is a clear mismatch between the ChromeDriver v79.0.3945.36 and Chrome Browser v78.0.3904.108
Solution
There are two possible solutions:
Either you need to downgrade ChromeDriver to ChromeDriver 78.0.3904.105
Download, install and use Chrome from the Chrome Release Channels
Linux Stable channel
Linux Beta channel
Linux Development channel
latest build
Related
I am trying to get selenium to open a site and I don't really have any errors in my PyCharm editor but when I run my code I am getting a lot of errors I do not really understand it would be nice to get some help
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(executable_path=r"C:\chromedriver\chromedriver.exe")
driver.get("https://www.singaporetech.edu.sg/") # get gets url
print(driver.title) # title of the page
driver.close()
This is the error I get:
C:\Users\kaush\PycharmProjects\seleniumTest1\venv\Scripts\python.exe C:/Users/kaush/PycharmProjects/seleniumTest1/main.py
Traceback (most recent call last):
File "C:\Users\kaush\PycharmProjects\seleniumTest1\main.py", line 4, in <module>
driver = webdriver.Chrome(executable_path=r"C:\chromedriver\chromedriver.exe")
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__
RemoteWebDriver.__init__(
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\kaush\PycharmProjects\seleniumTest1\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 87
Current browser version is 86.0.4240.198 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
This error message...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 87
Current browser version is 86.0.4240.198 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=87.0
Release Notes of chromedriver=87.0 clearly mentions the following :
Supports Chrome version 87
You are using Chrome v86.0.4240.198
So there is a clear mismatch between ChromeDriver v2.40 and the Chrome Browser v85.0
Solution
Ensure that:
ChromeDriver is updated to current ChromeDriver v87.0 level.
Chrome is updated to current Chrome Version 87.0 level. (as per ChromeDriver v87.0 release notes).
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.
So this is my first time working with selenium, and I get the chromedriver browser to open fo a quarter of a second and then it closes, even it I give it a webpage to load or I tell it to sleep. It also gives me a SessionNotCreatedException.
Code:
from selenium import webdriver
import time
class TestBot():
def __init__(self):
self.driver = webdriver.Chrome()
self.driver.get('http://www.google.com/')
time.sleep(5)
Error:
>>> bot = TestBot()
DevTools listening on ws://127.0.0.1:55101/devtools/browser/7029bc33-860f-42b8-8fb5-751cf27f82bc
[16708:17644:0524/045808.952:ERROR:browser_switcher_service.cc(238)] XXX Init()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "test_bot.py", line 6, in __init__
self.driver = webdriver.Chrome()
File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 83
I've tried adding Chromedriver as a path variable and that didn't work. I can start a chromedriver session just fine in cmd.
I think you should try running Selenium with MozillaFirefox,you also will need to install Geckodriver, which is a software that acts as a bridge between Firefox and selenium.
I was looking at the wrong version of chrome, turns out I have version 81, so I installed webdriver-manager and that works
as we see in the last line:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 83
try to:
update Chrome to last version so selenium too
use geckodriver.exe for chrome , and put inside a folder then try:
self.driver = webdriver.Chrome(r"c:\your\geckodriver\path\withput\")
This error message...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 83
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Analysis
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using ChromeDriver 83.0
Release Notes of ChromeDriver 83.0 clearly mentions the following :
Supports Chrome version 83
Most possibly the Chrome Browser haven't been updated to Chrome v83.0 yet as a part of the recent push and still is Chrome v81.0
Your Selenium Client version is unknown to us.
So there is a clear mismatch between ChromeDriver v83.0 and the Chrome Browser v81.0
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v83.0 level.
Chrome is updated to current Chrome Version 83.0 level. (as per ChromeDriver v83.0 release notes)
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
I am trying to open the URL using selenium in chrome. I have chromedriver available with me.
following is the code I want to execute.
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-infobars")
driver = webdriver.Chrome(executable_path="./chromedriver", chrome_options=chrome_options)
driver.get("https://google.com")
The browser is opened successfully but it doesn't open the specified URL. The URL in the browser is data:,.
Any help will be greatly appreciated. Please!
Please see the attached image.
Note: Selenium version : 3.14.0
I get the following error on closing the chrome tab.
File "test.py", line 6, in <module>
driver = webdriver.Chrome(executable_path="./chromedriver", chrome_options=chrome_options)
File "/home/speedious/anaconda3/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__
desired_capabilities=desired_capabilities)
File "/home/speedious/anaconda3/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
self.start_session(capabilities, browser_profile)
File "/home/speedious/anaconda3/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 251, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/speedious/anaconda3/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "/home/speedious/anaconda3/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.10.0-37-generic x86_64)
This error message...
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
...implies that the ChromeDriver instance was unable to start the Chrome Browser process.
Your main issue is the google-chrome is no longer present at the expected default location of /usr/bin/
As per ChromeDriver - Requirements the server expects you to have Chrome installed in the default location for each system:
1 For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. You can also override the Chrome binary location as follows:
A Windows OS based example:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("start-maximized")
options.binary_location("C:\\path\\to\\chrome.exe")
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', chrome_options=options)
driver.get('http://google.com/')
Additional Considerations
Upgrade ChromeDriver to current ChromeDriver v2.42 level.
Keep Chrome version between Chrome v68-70 levels. (as per ChromeDriver v2.42 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.
I found another reason for this behavior, which I don't see listed here. I believe Selenium libraries require Chrome Developer Tools to not be disabled. I was running into this issue and getting this regkey set got me past it.
Key - HKLM\Software\Policies\Google\Chrome
DWORD - DeveloperToolsDisabled
Value - 0
I must have some versions here that don't match up since I can't get Selenium with Python to fire up a Firefox web browser. I'm using an older version of Firefox because other people in here have the same old version of Python and for them the old version of Firefox works best.
Code:
from selenium import webdriver
from selenium import common
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
driver=webdriver.Firefox(capabilities=DesiredCapabilities.FIREFOX)
Error:
Traceback (most recent call last):
File "scrapeCommunitySelenium.py", line 13, in <module>
driver=webdriver.Firefox(capabilities=DesiredCapabilities.FIREFOX)
File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 158, in __init__
keep_alive=True)
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 311, in execute
self.error_handler.check_response(response)
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
Version info:
Python 2.7.10
Selenium 3.8.0
Firefox 46.0
GeckoDriver 0.19.1 (It's in a folder which is in my PATH environment variable)
MacOS 10.12.6
As you are using Selenium 3.8.0 you have to use GeckoDriver as a mandatory. But again as you are using Firefox v46.0 you have to set the capability marionette as False through DesiredCapabilities() as follows :
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
browser = webdriver.Firefox(capabilities=cap, executable_path="C:\\path\\to\\geckodriver.exe")
browser.get('http://google.com/')
browser.quit()
If you're going to use Geckodriver, you definitely need to use a newer version of Firefox. Frex: https://github.com/mozilla/geckodriver/releases/tag/v0.19.0 lists FF55 or greater.
If you plan on using FF46, don't use geckodriver. Update your capabilities to have marionette set to False:
caps = DesiredCapabilities.FIREFOX.copy()
caps['marionette'] = False
driver=webdriver.Firefox(capabilities=caps)
I had this issue on my MacOS 10.5 Catalina.
What I did:
1. Installed the geckodriver using brew install geckodriver
2. Deleted/uninstalled my existing(OLD) Firefox browser (v.46) and installed v70.
3. tried:
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://google.com')
The above worked fine with no errors, by launching Firefox and loading google.com
I got this error because the Firefox browser was not installed on my machine. You can download Firefox or download the Chrome driver here. If you use the Chrome drive, make sure you add it to the path (just like the geckodriver).
And the you can use it like this:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.python.org")
You can see similar error on Chrome as well. If you are seeing it on Ubuntu, the reason is probably you have a pre-installed version of Chrome and Firefox which is older. And you have downloaded the latest version of Chrome/Firefox driver.
Simple solution is:
Uninstall the existing Chrome/Firefox browser provided from Ubuntu : Go to Applications(top left corner)->Ubuntu software center-> search Chrome and uninstall it.
Install latest browser.
For Chrome, steps are as follows:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
Done!
There are some possible reasons for that error like:
Firefox is installed in your system
Firefox access is admin only
Firefox is not installed with same name
Firefox version is not updated
This error can also come from the version 32bits, choose a x64 version to fix it.
I can not launch Chrome in Selenium.
driver=webdriver.Chrome()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/anaconda/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 67, in __init__
desired_capabilities=desired_capabilities)
File "/usr/anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 87, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 141, in start_session
'desiredCapabilities': desired_capabilities,
File "/usr/anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 201, in execute
self.error_handler.check_response(response)
File "/usr/anaconda/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 181, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 3.19.8-100.fc20.x86_64 x86_64)
I use "chromedriver_linux64.zip 2017-10-03 21:09:52 3.90MB" from
url.
You are using the current latest chromedriver 2.33 with Google Chrome 38.0.2125.104.
From the release notes, the support for this version is:
----------ChromeDriver v2.33 (2017-10-03)----------
Supports Chrome v60-62
Make sure also that you are using the latest stable version of selenium.
Furthermore, from Help WebDriver find the downloaded ChromeDriver executable, you should do one of these
include the ChromeDriver location in your PATH environment variable
(Python only) include the path to ChromeDriver when instantiating webdriver.Chrome (see sample below)
If you're going to use an old version of Chrome - you will need to match the version of chromedriver to it. In your case you are using Chrome 38, which was last officially supported by ChromeDriver 2.13, which you can find here
If your users are using newer versions of Chrome, I would recommend updating your distro and installed chrome to match them.
The error says it all :
File "<stdin>", line 1, in <module>
Seems the error occurs on the very first line which is as :
driver=webdriver.Chrome()
This is because here in this code block unless you import webdriver, the driver object is unable to properly initiate/handle the instance of WebBrowser i.e. Chrome Browser.
Solution :
While working with Selenium 3.x, ChromeDriver 2.33.x you need Chrome Browser v60-62 with Python 3.x bindings, and you have to do the following:
Download the chromedriver binary from this link.
Import the necessary modules
Provide the absolute path of the chromedriver binary in your system.
Below is the minimal code :
//The Linux Example
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'/usr/bin/chromedriver')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
//The Windows Example
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
Update :
On a separate note as you are seeing WebDriverException: Message: unknown error: Chrome failed to start: crashed perform the following additional steps :
Uninstall Google Chrome from your system through Revo Uninstaller.
Run CCleaner to wipe out all the unwanted OS chores.
Take a system Reboot
Install latest official build of Google Chrome
Execute your Test.
import the selenium and chrome.option to let chrom run in headlessmode
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
if you use chrome or chromiun as root user on linux you should add "--no-sandbox" option and set windows size to avoid some item no show because the window size is too small
chrome_options = Options()
chrome_options.add_argument("--headless") # headless mode
chrome_options.add_argument("--no-sandbox") # run as root user should add --no-sandbox option
chrome_options.add_argument("--window-size=1920x1080")
you can download the chrome driver from http://chromedriver.storage.googleapis.com the last version is 2.38
chrome_driver = "path to chromedriver"
# start the driver
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=chrome_driver)
driver.get("https://www.google.com")