0

Good morning, I use selenium to do some webscraping, until yesterday everything worked fine, now I get this error, I know it is due to updating the binary, but as I want to share the programm, I would like the binary to be in the folder I created, so that it works with whoever opens the programme. This is the code:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.edge.options import Options
from selenium.webdriver.edge.service import Service
from selenium.webdriver.support.ui import WebDriverWait


# options
options = Options()
options.use_chromium = True
options.add_argument("--headless")
options.add_argument("disable-gpu")
options.add_argument('--allow-running-insecure-content')
options.add_argument('--ignore-certificate-errors')
options.add_experimental_option('excludeSwitches', ['enable-logging'])


# Selenium driver path
s=Service("./Monatseinteilung/driver/msedgedriver.exe")

driver = webdriver.Edge(service=s, options=options)

this is the error: selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of MSEdgeDriver only supports MSEdge version 100 Current browser version is 102.0.1245.30 with binary path C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe

1
  • your driver version is not compatible with your browser: Browser version: 102. Driver version: 100 Commented Jun 4, 2022 at 6:41

1 Answer 1

1

You have to change your msedgedriver.exe driver to match the MS Edge version you have installed on your computer (102). You can download that from here. Replace your msedgedriver.exe and this script should start working. You will have to do that every time MS Edge updates.

Since you are using Python and since you want to share the program, this may not be very convenient. So instead, you can try libraries such as selenium_driver_updater, or webdriver_auto_update although webdriver_auto_update only seems to support Chrome. After that, you can check for the latest driver available every time you run your script

For selenium_driver_updater

filename = DriverUpdater.install(path=base_dir, driver_name=DriverUpdater.chromedriver, upgrade=True, check_driver_is_up_to_date=True, old_return=False)
driver = webdriver.Chrome(filename)

For webdriver_auto_update:

check_driver('folder/path/of/your/chromedriver')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.