I am using C#, Microsoft.VisualStudio.TestTools.UnitTesting and Selenium to test a website.
I know MS Edge is no longer being developed, and is being replaced with a Chromium-based product. In the interim, I would still like to be able to tell my customers that Edge is a supported browser until the replacement occurs.
But it looks like using the selenium EdgeDriver requires a valid microsoftwebdriver - and the latest one is not compatible with the latest version of Windows - my machine uses Windows 10 Version 1809 / build 17763.379.
Has anyone been able to get Edge testing to work with Selenium on a Windows 10 build 1809 machine? If so, please show some sample code and needed steps / references / usings / etc.
If seen a few posting about this where some responses say it is impossible, and others say it is possible - but the ones that say it is possible don't show any actual code or reference names.
I apologize to any readers that I didn't post the solution I eventually found - which is quite simple. Here's the code of instantiating the driver:
var service = OpenQA.Selenium.Edge.EdgeDriverService.CreateDefaultService(@"C:\Drivers", @"msedgedriver.exe");
service.UseVerboseLogging = true;
service.UseSpecCompliantProtocol = true;
service.Start();
var options = new OpenQA.Selenium.Edge.EdgeOptions();
// For future reference - please check to see if there are options that should be set...
driver = new RemoteWebDriver(service.ServiceUrl, options);
As you can see, I keep the latest edge driver in a dircetory called "C:\\Drivers". The latest driver can always be downloaded from the selenium website downloads page ( https://www.selenium.dev/downloads/ ) - expand the Browsers section on that page.
Sample C# Code
else if (AppSettings.Browser == "Edge")
{
EdgeOptions edgeOptions = new EdgeOptions()
{
UseInPrivateBrowsing = true,
};
driver = new EdgeDriver(edgeOptions);
}
and Remove all Nuget references to MicrosoftDriver, Clean the Solution Then Run the below command in CMD Admin mode
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
Note: This Solution is for Microsoft Edge version 18 or Above
Well after a long time navigating the internet found a solution for that!
At least you have to remove your NuGet package WebDriver(actual version) and install the beta version, then go to this website https://www.nuget.org/packages/Selenium.WebDriver/4.0.0-beta2 copy the beta nuget you want in my case 4.0.0 till the moment, then open your visual studio (mine is 2019) Tools>Nuget Package Manager>Package Manger Console here you paste your copy. Ps. make download from edge chromium
using OpenQA.Selenium.Edge;
public class Example Edger
{
private IWebDriver driver;
public void SetupTest()
{
driver = new EdgeDriver();
driver.Manage().Window.Maximize();
}
}
You need to install edge driver version equal to the version of edge in your system. To find edge version number go to settings->about microsoft edge .Download the correct version from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver After downloading you need to change the name of driver to MicrosoftWebDriver.exe from msedgedriver.exe. Then It will work :)
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.