Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using OpenQA.Selenium;
using OpenQA.Selenium.Edge;
using System;
namespace EdgeDriverTests
{
public class Program
{
/*
* This assumes you have added MicrosoftWebDriver.exe to your System Path.
* For help on adding an exe to your System Path, please see:
* https://msdn.microsoft.com/en-us/library/office/ee537574(v=office.14).aspx
*/
static void Main(string[] args)
{
/* You can find the latest version of Microsoft WebDriver here:
* https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
*/
var driver = new EdgeDriver();
// Navigate to Bing
driver.Url = "https://www.bing.com/";
// Find the search box and query for webdriver
var element = driver.FindElementById("sb_form_q");
element.SendKeys("webdriver");
element.SendKeys(Keys.Enter);
Console.ReadLine();
driver.Quit();
}
}
}
@ralucasuditu
Copy link

ralucasuditu commented Feb 4, 2017

hi, how to we set
'browser.download.dir': DOWNLOAD_ABSOLUTEPATH,
'prompt_for_download': false

in a protractor config file for edge driver?

@InstyleVII
Copy link
Author

InstyleVII commented Aug 7, 2017

I've updated the public gist to no longer require RemoteWebDriver and be a simpler example.

@rhysstubbs
Copy link

rhysstubbs commented Jul 12, 2019

For anyone having issue and managed to land here, I was receiving the following two errors:

OpenQA.Selenium.DriverServiceNotFoundException: The MicrosoftWebDriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. && . OpenQA.Selenium.WebDriverException: unknown error: cannot find Microsoft Edge binary.

These were both caused by an incorrect version of the MicrosoftWebDriver. My suggestion is even if you're able to manually launch the driver and it appears to be working, head here and download the version that matches your version of Microsoft Edge (Microsoft Edge 38.14393.2068.0 / Microsoft EdgeHTML 14.14393 in my case)

@BandyaDhapate
Copy link

BandyaDhapate commented Jul 12, 2019

I am trying to execute mgsedgedriver on Mac. I am seeing this error --
org.openqa.selenium.WebDriverException: unknown error: cannot find Microsoft Edge binary

If I don't put file at specified path then I see file not found error and when file is present then I see this. I can open driver by double clicking on it. So not sure what's going on here.
Thank you for your help.

@rhysstubbs
Copy link

rhysstubbs commented Jul 15, 2019

I am trying to execute mgsedgedriver on Mac. I am seeing this error --
org.openqa.selenium.WebDriverException: unknown error: cannot find Microsoft Edge binary

If I don't put file at specified path then I see file not found error and when file is present then I see this. I can open driver by double clicking on it. So not sure what's going on here.
Thank you for your help.

You'll probably find that the version of the MicrosoftWebDriver is incorrect. I received this error in that case and downloading the correct version as per my version of Edge resolved the error.

@BandyaDhapate
Copy link

BandyaDhapate commented Jul 15, 2019

I am trying to execute mgsedgedriver on Mac. I am seeing this error --
org.openqa.selenium.WebDriverException: unknown error: cannot find Microsoft Edge binary
If I don't put file at specified path then I see file not found error and when file is present then I see this. I can open driver by double clicking on it. So not sure what's going on here.
Thank you for your help.

You'll probably find that the version of the MicrosoftWebDriver is incorrect. I received this error in that case and downloading the correct version as per my version of Edge resolved the error.

Thank you. I have Version 77.0.211.3 (Official build) Dev (64-bit) installed on my Mac and downloaded matching driver. Still receiving this error. I just double checked it.

@SimpleSamples
Copy link

SimpleSamples commented Mar 4, 2020

I could not get this to work either. I am using the new Chromium Edge and that is a likely problem. I found WebDriver (Chromium) but that had problems too. I did a little guessing and the following works for me. I hope this is relevant.

	var edgeOptions = new EdgeOptions();
	var msedgedriverDir = @"D:\Software";
	var msedgedriverExe = @"msedgedriver.exe";
	var service = EdgeDriverService.CreateDefaultService(msedgedriverDir, msedgedriverExe);
	var driver = new EdgeDriver(service, edgeOptions);
	driver.Navigate().GoToUrl("https://bing.com");
	Thread.Sleep(2000);
	driver.Close();
	service.Dispose();

@Telavian
Copy link

Telavian commented Apr 9, 2020

How to open as headless with no window?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment