0

im trying to run my discord-bot on REPLIT my script uses selenium

  options = Options()
  options.add_argument("--headless")
  options.add_argument("--log-level=3")
  options.add_argument('--no-sandbox')
  options.add_argument('--disable-dev-shm-usage')

  driver = webdriver.Chrome(options=options)
  driver.get(link)

crash log

The chromedriver version (108.0.5359.71) detected in PATH at /nix/store/i85kwq4r351qb5m7mrkl2grv34689l6b-chromedriver-108.0.5359.71/bin/chromedriver might not be compatible with the detected chrome version (116.0.5845.96); currently, chromedriver 116.0.5845.96 is recommended for chrome 116.*, so it is advised to delete the driver in PATH and retry

how do i install newer version like 116.*

Gugu72
  • 2,052
  • 13
  • 35
VesoMa
  • 1
  • 1
  • Does this answer your question? [selenium.common.exceptions.SessionNotCreatedException: This version of ChromeDriver only supports Chrome version 114. LATEST\_RELEASE\_115 doesn't exist](https://stackoverflow.com/questions/76913935/selenium-common-exceptions-sessionnotcreatedexception-this-version-of-chromedri) – Gugu72 Aug 25 '23 at 07:32

2 Answers2

0

Basically the error is due to the fact that the chromedriver version that you will execute with selenium needs to match the chrome browser version that you are running (Which in your case is the latest = 116)

Step1 : Download the appropriate chrome driver version 116 here

Step2: Add imports to your code of selenium webdriver manager

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

Step3 : Add the downloaded chrome driver path to your code

For better help , here is a full working code example :

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

# chrome driver path to file downloaded
s=Service('........./chromedriver116')

# Setting up Chrome options - whichever options you need
chrome_options = webdriver.ChromeOptions()

chrome_options.add_argument("--lang=en")
chrome_options.add_argument("--disable-features=NetworkService")
chrome_options.add_argument('headless')
chrome_options.page_load_strategy = 'eager'

# get url
browser = webdriver.Chrome(service=s, options=chrome_options)
url = 'https://example.com'
browser.get(url)
0

Use WebDriver-Manager library to automatically update the driver's version.

Installation:

pip install webdriver-manager

Usage:

# selenium 3
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())
# selenium 4.0
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))
I.sh.
  • 252
  • 3
  • 13