简体   繁体   中英

How to set up Selenium Grid to run InternetExplorerDriver in C#

I'm currently struggling to set up Selenium Grid to execute Selenium Webdriver Tests written in C#.

The WebDriver Tests are located on my my machine.

I installed the RC Standalone in my VM.

When using the following code

public static IWebDriver Instance { get; set; }
Instance = new RemoteWebDriver(new Uri("http://192.xxx.x.xxx:4444/wd/hub"), DesiredCapabilities.Firefox());

The tests run fine in the VM (firefox is launched and the tests are exceuted as expected)

The issue is when I am trying to use InternetExplorer

1) I changed the DesiredCapabilities to Internet Explorer in my test:

public static IWebDriver Instance { get; set; }

Instance = new RemoteWebDriver(new Uri("192.xxx.x.xxx:4444/wd/hub"), DesiredCapabilities.InternetExplorer());

2) Downloaded the InternetWebDriverServer.exe and Install it in the VM (not my local machine where the tests reside) C:\\Selenium\\IEDriver (this C: is the VM one)

3 - Configured the RC Grid in the VM with the following command line:

java -jar C:\Selenium\RC\selenium-server-standalone-2.44.0.j
ar -Dwebdriver.internetexplorer.driver=C:\Selenium\IEDriver\IEDriverServer.exe

When I run the tests, I get the following error

The path to the to the driver executable must be set by the webdriver.ie.driver system property.

NB: The tests run perfectly fine on my local machine using

IEWebDriverServer.exe with the following code
public static IWebDriver Instance { get; set; }

Instance = new InternetExplorerDriver(@"C:\Libraries");

The error states exactly what you are missing.

The error message says:

The path to the to the driver executable must be set by the webdriver.ie.driver system property

You are setting webdriver.internetexplorer.driver . You need to set webdriver.ie.driver

( ie vs internetexplorer )

Here is an example of how I init my driver for IE11

public void Initialize()
        {
            String webURL = "http://www.google.com";
            String myHub = "http://QA_HUB:4444/wd/hub";
            var caps = DesiredCapabilities.InternetExplorer();
            caps.SetCapability(CapabilityType.BrowserName, "internet explorer");
            caps.SetCapability(CapabilityType.Platform, "VISTA");
            driver = new RemoteWebDriver(new Uri(myHub), caps, TimeSpan.FromSeconds(600));
            driver.Navigate().GoToUrl(webURL);
            Console.WriteLine("Opened Browser & Navigated To URL");
        }

The IEDriverServer.exe is saved in C:\\Program Files\\Java\\jdk1.8.0_77\\bin and ensure that you have the folder pointed in System Settings Path and not the actual exe.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM