pythonselenium-webdrivertestingbrowsermicrosoft-edge

Using python selenium for Microsoft edge


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) 

Solution

  • 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.