smoochyboi
smoochyboi

Reputation: 11

How to open up Microsoft Edge using Selenium and Python

I've already added the msedge driver into the path variable.

cmd confirmed that MSEdgeDriver was started successfully,

however, when I run


import os

from selenium import webdriver

browser2 = webdriver.Edge()

I get an exception error that says

"WebDriverException: Message: 'MicrosoftWebDriver.exe' executable needs to be in PATH."

help

Upvotes: 0

Views: 32489

Answers (5)

Ameen Maheen
Ameen Maheen

Reputation: 2737

  1. You need to download the browser driver from here
  2. After the download completes, extract the driver executable to your preferred location. Add the folder where the executable is located to your PATH environment variable.

More details can be found here

Upvotes: 0

V. friesen
V. friesen

Reputation: 1

A quick fix for this issue: go to the path with the edge driver and rename it. from msedgedriver to MicrosoftWebDriver. This should resolve this issue

Upvotes: 0

AnibaldelReal
AnibaldelReal

Reputation: 1

You should rename the drivername.exe to MicrosoftWebDriver.exe. This file is taken from the path that you set in the environmental variables

Upvotes: 0

rahul rai
rahul rai

Reputation: 2326

If you want to open your driver without specifying path of your executable driver every-time you try to launch, Place the msedgedriver.exe's path into PATH (on Windows computer ). Then you can call default constructor of Web Driver class as below:

browser2 = webdriver.Edge()

Upvotes: 0

undetected Selenium
undetected Selenium

Reputation: 193078

As per the documentation in Use WebDriver (Chromium) for test automation, you need to follow the steps mentioned below:

edge-version.png

edge


Code Block

Now, you can use the following code block:

from selenium import webdriver

driver = webdriver.Edge(executable_path=r'C:\path\to\msedgedriver.exe')
driver.get('edge://settings/help')
print("Page title is: %s" %(driver.title))
#driver.quit()

Upvotes: 3

Related Questions