automated testing – Selenium Webdriver got error cannot find msedge binary using google colaboratory and python

The error cannot find msedge binary occurs when the Edge binary is not installed or the path to the Edge binary is not set in the system environment variables. Since you are using Google Colaboratory, it is possible that the Edge browser is not installed on the machine running the code.

To fix the issue, you can try specifying the path to the Edge binary explicitly using the executable_path parameter when creating the webdriver instance. Here’s an example:

from selenium import webdriver

options = webdriver.EdgeOptions()
options.use_chromium = True
options.binary_location = '/path/to/msedge.exe'

driver = webdriver.Edge(executable_path="/path/to/msedgedriver.exe", options=options)

Replace the /path/to/msedge.exe and /path/to/msedgedriver.exe with the actual paths to the Edge binary and the Edge webdriver respectively.

Note that the webdriver.Edge() function is used to create an instance of the Edge webdriver, which is used to automate the Edge browser. It does not automatically open a URL in the browser. To open a URL, you need to call the get() method of the webdriver instance, like this:

driver.get('https://www.example.com')

This will open the URL https://www.example.com in the Edge browser.

Read more here: Source link