This question already has answers here:
SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81
(37 answers)
Closed 2 years ago.
I want to use chrome webdriver with python and selenium library; however, I'm having problems opening webdriver in python console. It is finding the path and it opens what it seems to be a browser, also it starts a service listening on port #### but when I do
driver.get('http://www.google.com')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'driver' is not defined
it doesn't work... here's the error I'm getting when I open a website
here's the output of opening webdriver
driver = webdriver.Chrome('C:\chromedriver\chromedriver.exe')
DevTools listening on ws://127.0.0.1:52968/devtools/browser/b7b88ebb-e9e1-4726-9d4e-4e3f13990a0a Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\George\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__
RemoteWebDriver.__init__(
File "C:\Users\George\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\George\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\George\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\George\AppData\Local\Programs\Python\Python38-32\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 81
You need your chromedriver.exe to match your current chrome browser's version. To check your chrome version go into your chrome settings and select the about chrome tab. You can find your chrome version there. Then download the chromedriver from here that matches your version. Update the path in your code to this driver and it should work.
Related
I would like to run chromedriver_autoinstaller. I follow example here: https://pypi.org/project/chromedriver-autoinstaller/
from selenium import webdriver
import chromedriver_autoinstaller
chromedriver_autoinstaller.install() # Check if the current version of chromedriver exists
# and if it doesn't exist, download it automatically,
# then add chromedriver to path
driver = webdriver.Chrome()
driver.get("http://www.python.org")
assert "Python" in driver.title
But I got an error:
Traceback (most recent call last):
File "/usr/lib/python3.8/code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 9, in <module>
File "/home/vojtam/Desktop/greads_scrape/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
RemoteWebDriver.__init__(
File "/home/vojtam/Desktop/greads_scrape/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/home/vojtam/Desktop/greads_scrape/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/vojtam/Desktop/greads_scrape/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/vojtam/Desktop/greads_scrape/venv/lib/python3.8/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: DevToolsActivePort file doesn't exist
What does it mean? Is this package still working?
This error message...
org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
A common cause for Chrome to crash during startup is running Chrome as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Chrome as a regular user instead.
Execute your test as a regular user.
References
You can find a couple of detailed discussions in:
WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser
unknown error: DevToolsActivePort file doesn't exist error while executing Selenium UI test cases on ubuntu
Tests fail immediately with unknown error: DevToolsActivePort file doesn't exist when running Selenium grid through systemd
This question already has answers here:
SessionNotCreatedException: This version of ChromeDriver only supports Chrome version 84 using ChromeDriver and Chrome through Selenium and Python
(4 answers)
Closed 2 years ago.
I cannot get my Chromedriver to work and have downloaded a few different versions with no change in the output error. My code is:
from selenium import webdriver
driver= webdriver.Chrome('C:/Users/Admin/Desktop/chromedriver.exe')
driver.get("https://www.google.com")
and the output in the kernel is
Traceback (most recent call last):
File "C:\Users\Admin\Desktop\Market Bot.py", line 11, in <module>
driver= webdriver.Chrome('C:/Users/Admin/Desktop/chromedriver.exe')
File "C:\Users\Admin\anaconda3\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Users\Admin\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\Admin\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Admin\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Admin\anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 84
How do I get it to work?
Check what version of chrome you're running, as of writing this version 83 is the stable public release. You can check by going to this url: chrome://settings/help
Download the same version of the chrome driver as the version of chrome you have, so if you're on chrome version 83, download the chrome driver with version 83. You can get chrome drivers here: https://chromedriver.chromium.org/downloads
Point your script at the correct chrome driver version.
So i use PyCharm 2018.2.3, geckodriver 0.20, Firefox 63.0 and Python 3.6.5 in it for my Selenium auto-tests.
What I try to do in Python Console to run the driver:
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True
wd = webdriver.Firefox(executable_path="C:\\Users\\user\\geckodriver.exe", firefox_profile=profile)
So the geckodriver runs in a new window. Then I ususally write
url = "https://website-address.com/"
wd.get(url)
But this time I get the message:
Previous command is still running. Please wait or press Ctrl+C in console to interrupt.
And then in like a couple of minutes geckodriver exit with these messages in log:
Traceback (most recent call last):
File "<input>", line 4, in <module>
File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 170, in __init__
keep_alive=True)
File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 251, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "C:\Users\user\project\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: newSession
Please help me to understand what is going on and how to fix it.
I was having the same problem and was fixed after I update the geckodriver to v0.21.0
So I've opened an issue on geckodriver github (https://github.com/mozilla/geckodriver/issues/1369), which was closed by a developer and I got an actual answer here in another similar issue: https://github.com/mozilla/geckodriver/issues/1305 - they've released a new version of geckodriver which fixed everything.
P.S. I'm almost absolutely sure I had no issues with my firewall.
I am using geckodriver for Firefox and I'm running Python 3 with Selenium. This is my code in the file script.py:
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.google.com')
Once I run it with python3 script.py with my terminal, it launches Firefox but simply doesn't load the page, nor does it insert the link in the address bar. My geckodriver is installed at this location: /usr/local/bin/geckodriver.
After waiting for about a minute, I get the following error:
Traceback (most recent call last):
File "script.py", line 3, in <module>
browser = webdriver.Firefox()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 154, in __init__
keep_alive=True)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 151, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 240, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: connection refused
I already searched a lot for fixes but none of them worked.
After I realized, I was using Firefox ESR instead of the normal one, I switched to the normal Firefox version and faced this problem:
Traceback (most recent call last):
File "script.py", line 3, in <module>
driver = webdriver.Firefox(executable_path=r'/root/Downloads/firefox-56.0.1/firefox/firefox')
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 144, in __init__
self.service.start()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 102, in start
raise WebDriverException("Can not connect to the Service %s" % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /root/Downloads/firefox-56.0.1/firefox/firefox
Which version of Selenium/Geckodriver/Browser are you using?
Anyway, do you set the executable_path:
driver = webdriver.Firefox(executable_path=r'pathTo/geckodriver')
?
EDIT
If you are using:
Selenium version = 3.6.0
Geckodriver version = 0.19.0
Firefox version = 52.4.0
Your problem is Firefox. From GeckoDriver releases, is recommended Firefox 55.0 (and greater).
When on windows I want to give a try with the webdriver extension for selenium, I get an error. I installed the python bindings like on the installation page. And then I try to to just the following:
from selenium import webdriver
browser = webdriver.Firefox()
Firefox (15.0) is opened and after that an exception occurs:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\selenium-2.32.0-py2.7.egg\selenium\webdriver\firefox\webdriver.py", line 62, in __init__
desired_capabilities=capabilities)
File "C:\Python27\lib\site-packages\selenium-2.32.0-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 72, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium-2.32.0-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 114, in start_session
'desiredCapabilities': desired_capabilities,
File "C:\Python27\lib\site-packages\selenium-2.32.0-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 165, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium-2.32.0-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 152, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: ''
I tried the same without webdriver, with the 1.0 api and then I can open Firefox and go to a specific page, but with the webdriver case I do not have any luck. Has anyone a clue what I do wrong ?
My OS is Windos 7, 64 bit version.
I also tried the same with the latest python bindings from version control, but that has the same error.