Selenium with Microsoft Edge driver never finishes initialising

别来无恙 提交于 2019-11-27 02:52:37

问题


I'm using the C# bindings for Selenium and trying to get a simple automated test in Microsoft Edge working.

class Program
{
    static void Main(string[] args)
    {
        EdgeOptions options = new EdgeOptions();
        options.PageLoadStrategy = EdgePageLoadStrategy.Eager;
        RemoteWebDriver driver = new EdgeDriver();
        driver.Url = "http://bing.com/";
    }
}

But the program halts on the initialisation of the EdgeDriver, the edge browser launches but the url never changes to "bing.com".

Has anyone else experienced this?


回答1:


I have faced the same issue. I followed the below steps to resolve it :-

Download the correct Microsoft WebDriver server version for your build.

How to find your correct build number :-

1- Go to Start > Settings > System > About and locate the number next to OS Build on the screen. This is your build number. Having the correct version of WebDriver for your build ensures it runs correctly.

2- Run this command systeminfo | findstr /B /C:"OS Version" this will give the output like OS Version: 10.0.10586 N/A Build 10586. Here is build number is 10586

You need to check your Windows OS build number and download appropriate .msi and install it.

Provide the Syetem property where MicrosoftWebDriver.exe installed to webdriver.edge.driver.

Note :- The Default installed location of the MicrosoftWebDriver.exe :-

for 64 bit is C:\Program Files (x86)\Microsoft Web Driver
for 32 bit is C:\Program Files\Microsoft Web Driver

Hope it will work...:)




回答2:


This happens when your system does not match the webdriver version... Determine which release of Windows 10 you are using... then go here and download same release.. https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver

Here's what the error looks like when the versions don't match.

Selenium will Hang

 EdgeOptions options = new EdgeOptions();
 options.PageLoadStrategy = EdgePageLoadStrategy.Eager;
 RemoteWebDriver driver = new EdgeDriver();
 driver.Url = "http://bing.com/";

Results in this exception with Edge still up and on the Bing page

Exception Thrown

changing the code to this, with no options:

  var driver = new EdgeDriver();
  driver.Url = "http://bing.com/";

Results in this:

Exception thrown: 'System.InvalidOperationException' in WebDriver.dll

And this in the console.

Something's not right with the MicrosoftWebDriver.Exe which was downloaded from here. https://www.microsoft.com/en-us/download/details.aspx?id=48212 and installed into the Program Files folder by default. Here's screenshot of add/remove programs. System is Windows 10 PRO 64 bit.

Note I did not try the 32 bit version



来源:https://stackoverflow.com/questions/36865751/selenium-with-microsoft-edge-driver-never-finishes-initialising

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!