使用C#的同一台机器上的Selenium网格集线器和节点

时间:2015-10-27 11:06:24

标签: c# selenium-grid

我尝试使用C#运行selenium网格测试用例。我使用相同的机器作为集线器和节点。 到strat节点

D:\Selenium>java -jar selenium-server-standalone-2.48.2.jar -role webdriver -hub
 http://10.74.224.251:4444/grid/register -browser browserName=internet explorer,
platform=WINDOWS version=7 -port 5556 -dwebdriver.ie.driver="D:\Selenium\DLL\IED
riverServer_Win32_2.45.0\IEDriverServer.exe"

并启动中心

D:\Selenium\DLL>java -Dwebdriver.ie.driver="D:\Selenium\DLL\IEDriverServer_Win32
_2.45.0\IEDriverServer.exe" -jar selenium-server-standalone-2.48.2.jar -role hub

并在C#中编写了以下代码

IWebDriver driver;
            string baseURL, nodeURL;
            baseURL = "https://www.google.co.in/";
            nodeURL = "http://10.74.224.251:5556/wd/hub";

            System.Environment.SetEnvironmentVariable("webdriver.ie.driver", @"D:\Selenium\DLL\IEDriverServer_Win32_2.45.0");
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities = DesiredCapabilities.InternetExplorer();

            capabilities.SetCapability(CapabilityType.BrowserName, "internet explorer");
            capabilities.SetCapability(CapabilityType.Version, "7");
            capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Windows));
            driver = new RemoteWebDriver(new Uri(nodeURL), capabilities);
            driver.Navigate().GoToUrl(baseURL);

但是代码没有执行并且每次都抛出以下错误

An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll
Additional information: The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html
The program '[8472] Selenium First Project.vshost.exe: Managed (v4.0.30319)' has exited with code -1073741510 (0xc000013a).

但是我应该这样做,或者任何人都有相同的示例代码

由于

0 个答案:

没有答案