使用python selenium for Microsoft edge

使用python selenium for Microsoft edge,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我正在尝试使用pythons selenium for Microsoft edge,但不断出现以下错误: WebDriverException: Message: unknown error: cannot find Microsoft Edge binary 我下载了edge驱动程序的最新版本。这是我的密码: from selenium import webdriver from selenium.webdriver.remote import webelement from seleni

我正在尝试使用pythons selenium for Microsoft edge,但不断出现以下错误:

WebDriverException: Message: unknown error: cannot find Microsoft Edge binary
我下载了edge驱动程序的最新版本。这是我的密码:

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) 

WebDriver找不到您的MS Edge路径,您可以尝试卸载并重新安装Edge。
如果这无助于将边缘位置添加到系统路径或使用--binary参数。

这篇文章现在已经很老了,但希望我能在将来帮助任何遇到相同问题的人

问题是您使用了错误的Web驱动程序。Edge有两个不同的版本,在两个不可互换的引擎上实现——Chromium Edge和EdgeHTML(撰写本文时的默认版本)。这两个版本中的每一个都有一个与之关联的不同的webdriver,Chromium Edge是“msedgedriver.exe”,EdgeHTML是“MicrosoftWebDriver.exe”

您正在使用Edge的EdgeHTML版本,同时尝试运行Chromium Edge webdriver。Selenium弹出的“找不到Microsoft Edge binary”错误就是由此产生的

幸运的是,安装正确的webdriver很容易。如果您有Edge 17或更早版本,则可以安装驱动程序。确保下载EdgeHTML驱动程序,而不是Chromium驱动程序,并将其添加到路径中。对于Edge 18及更高版本,您无需下载任何内容。只需在命令提示符下运行命令:
DISM.exe/Online/Add-Capability/CapabilityName:Microsoft.WebDriver~~~~~0.0.1.0

的答案是完美的总结。我有Microsoft EdgeHTML 18.17763,因此我尝试运行以下命令:

DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
这是成功执行的。但是,当这次运行代码时,我得到了一个错误:

Message=发送HTTP时引发了具有空响应的异常 向远程WebDriver服务器请求URL . 异常的状态为 ReceiveFailure,消息为:基础连接为 已关闭:接收时发生意外错误


看起来我们还需要在
Windows>>设置>>开发人员选项中启用开发人员选项,因为我没有管理员权限,所以目前无法启用该选项。

似乎您缺少路径中的用户。。。还请注意,最新的EdgeDriver版本是通过Edge本身安装的。。。他们称之为“按需功能”:安装后路径将始终相同…SYSWOW64。(或者可能是32位操作系统上的System32?)将边缘位置添加到我下载的边缘驱动程序中?你是否先尝试重新安装它?如果没有帮助,请尝试将边缘路径添加到系统路径中。我确实重新安装了它,但在windows或mac上仍会遇到相同的错误?