I am trying to use pythons selenium for Microsoft edge but I keep getting this error:
WebDriverException: Message: unknown error: cannot find Microsoft Edge binary
I downloaded the latest version of the edge driver. Here is my code:
from selenium import webdriver
from selenium.webdriver.remote import webelement
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
import pandas as pd
import time
from bs4 import BeautifulSoup
import os
from datetime import datetime
from selenium.webdriver import ActionChains
driver = webdriver.Edge(executable_path = 'C:\\Users\\Downloads\\edgedriver_win32\\msedgedriver.exe')
def get_trulia_estimate(address):
driver.get('https://www.trulia.com/')
print(address)
element = (By.ID, 'homepageSearchBoxTextInput')
WebDriverWait(driver, 10).until(EC.element_to_be_clickable(element)).click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable(element)).send_keys(address)
search_button = (By.CSS_SELECTOR, "button[data-auto-test-id='searchButton']")
WebDriverWait(driver, 50).until(EC.element_to_be_clickable(search_button)).click()
time.sleep(3)
This post is quite old now, but hopefully I can help anyone that stumbles upon the same issue in future!
The problem is that you're using the wrong webdriver. Edge exists in two different versions, implemented on two non-interchangeable engines -- Chromium Edge and EdgeHTML (the default version at the time of writing). Each of these two versions has a different webdriver associated with it, with Chromium Edge's being "msedgedriver.exe", and EdgeHTML's being "MicrosoftWebDriver.exe".
You are using the EdgeHTML version of Edge, while trying to run the Chromium Edge webdriver. The 'cannot find Microsoft Edge binary' error Selenium spits out comes from this.
Luckily it is easy to install the right webdriver. If you have a Edge 17 or older, you can install the driver here . Make sure you download the EdgeHTML driver, not the Chromium driver, and add it to your PATH. For Edge 18 and later, you don't have to download anything. Simply run in the command prompt the command: DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
.
WebDriver cannot find your MS Edge path, u can try to uninstall and reinstall Edge. If its not gonna help add Edge location to your system path or use --binary argument.
The Answer by James L is perfectly summarized. I have Microsoft EdgeHTML 18.17763 and I tried to, therefore, run the command:
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
This executed successfully. However, when running my code this time around, I get the error:
Message=A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:52109/session . The status of the exception was ReceiveFailure, and the message was: The underlying connection was closed: An unexpected error occurred on a receive.
Looks like we need to, additionally, also enable developer options in Windows>>Settings>>Developer Options
, which, since I do not have admin privileges, I am currently unable to do.
You must install msedge driver as You do with Chromedriver.
edgeBrowser = webdriver.Edge(r"C:....\msedgedriver.exe") edgeBrowser.get('https://www.google.com')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.