I have a python script running on an EC2 instance (ubuntu) on AWS. It uses selenium. It was working perfectly for weeks, and then all of the sudden, today, it stopped work
This error message...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 79
...implies that the ChromeDriver v79 was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session where the browser version was other then v79.x.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Supports Chrome v79
google-chrome
when installed at the default location with respect to the underlying os:1For Linux systems, the ChromeDriver expects /usr/bin/google-chrome
to be a symlink to the actual Chrome binary.
There are two solutions:
google-chrome
installed at the default location to current Chrome Version 79.0 level. (as per ChromeDriver v79.0 release notes)Or you can override the default Chrome binary location i.e. /usr/bin/google-chrome
with the chromium-browser
binary location following the documentation Using a Chrome executable in a non-standard location as follows:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location='/path/to/chromium-browser.exe'
driver = webdriver.Chrome(executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe', options=options)
driver.get('http://google.com/')
You can find a detailed discussion in How to run a Chromium Browser with Selenium?
@Test
as non-root user.driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.You can find a relevant detailed discussion in: