Is there a way to open HTTP web in Edge using selenium and iedriver?

651 views Asked by At

So i'm using this code but if the web is HTTP it opens on IE instead of Edge.

var ieOptions = new InternetExplorerOptions();
        ieOptions.EdgeExecutablePath = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe";
        IWebDriver driver = new InternetExplorerDriver(ieOptions);

        driver.Url = "some http web";

is there a way to force it on edge?

2

There are 2 answers

0
Greg Burghardt On

You need to download Microsoft Edge Driver and use that. The name of the class your code currently uses should give you a hint about why Internet Explorer is being opened:

IWebDriver driver = new InternetExplorerDriver(ieOptions);
                        ^^^^^^^^^^^^^^^^

It is right in the name: InternetExplorerDriver. You are using the web driver for Internet Explorer. If you want to automate Edge, you need to use EdgeDriver.

I think the curious thing is that Edge is launched when loading an HTTPS URL when using InternetExplorerDriver. I suspect there are Windows Policies installed that override Internet Explorer causing Edge to be launched instead.

0
STG On

Create InternetExplorerDriver and pass the InternetExplorerOptions:

var options = new InternetExplorerOptions
{
    AttachToEdgeChrome = true,
    EdgeExecutablePath = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
};

var driver = new InternetExplorerDriver(options);
driver.Url = "https://example.com";

This will open Edge in IE mode... If you don't need IE mode you need to use EdgeDriver instead of InternetExplorerDriver and EdgeOption instead of InternetExplorerOptions