0

I'm up with python 3.8 and selenium but recently I downloaded the latest edge web driver zip file and runned the mswdedriver.exe from that and typed this code in my ide:

from selenium import webdriver

browser = webdriver.Edge('‪F:\za\python\Assistant\msedgedriver.exe')
browser.maximize_window()
browser.get(url='http://seleniumhq.org/')

but I see this error:

selenium.common.exceptions.WebDriverException: Message: 'MicrosoftEdgeDriver' executable needs to be 
in PATH. Please download from http://go.microsoft.com/fwlink/?LinkId=619687

Can you help me friends? Thanks in advance.

4 Answers4

1

You need to give a path to the webdriver executable when you load a webdriver, or have it stored as an environment variable:

webdriver.Edge(executable_path="path/to/executable")

A web driver is essentially a special browser application, you must install that application before you can run anything with it.

Here's Edge's web driver download page. Or you can use the link from the error message http://go.microsoft.com/fwlink/?LinkId=619687

Here's a similar question Python Selenium Chrome Webdriver

M Z
  • 4,571
  • 2
  • 13
  • 27
  • 1
    If you do not know how to add it to your environment variable it has been answered here: https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho/44272417 If you complete these steps your code will work as is, but if you want add the executable file as the answer states into the `webdriver.Edge`. – Eno Gerguri Jun 25 '20 at 20:01
  • but giving the path as `F:\za\python\Assistant\msedgedriver.exe` I still see the folowing error `selenium.common.exceptions.WebDriverException: Message: 'msedgedriver.exe' executable needs to be in PATH. Please download from http://go.microsoft.com/fwlink/?LinkId=619687` – Mohammad Kamrul Hasan Jun 26 '20 at 02:57
  • Could you edit your original post to reflect your code change? – M Z Jun 26 '20 at 03:14
0

The backslashes in the executable path need to be escaped, per Python syntax:

browser = webdriver.Edge('‪F:\\za\\python\\Assistant\\msedgedriver.exe')
guest
  • 1
0

This problem appears to me you must put in "Bin Folder" the file "MicrosoftWebDriver.exe" as is , edit the previous name of edge webdriver to be "MicrosoftWebDriver.exe" and put it in the "Bin Folder"

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.
Ameen Maheen
  • 2,719
  • 1
  • 28
  • 28