0

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

Ehsan
  • 12,072
  • 2
  • 20
  • 33
smoochyboi
  • 11
  • 1
  • 2
  • 1
  • 3
    Does this answer your question? [Error message: "'chromedriver' executable needs to be available in the path"](https://stackoverflow.com/questions/29858752/error-message-chromedriver-executable-needs-to-be-available-in-the-path) – rahul rai Aug 22 '20 at 07:12

5 Answers5

2

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()
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thanks for the help, but is there anyway to run webdriver.Edge just as webdriver.Edge() without the executable path? – smoochyboi Aug 21 '20 at 21:37
0

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()
rahul rai
  • 2,260
  • 1
  • 7
  • 17
  • I added it to the system variables PATH, but it still doesn't seem to work. – smoochyboi Aug 23 '20 at 00:52
  • Make sure that the name of the PE file matches the expected one. Currently, it is `MicrosoftWebDriver.exe`. Otherwise, set a debug point where Selenium fails when locating the executable and inspect the expected file name. – PAX Apr 13 '21 at 13:01
0

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

0

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

0
  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

Ameen Maheen
  • 2,719
  • 1
  • 28
  • 28