我用 c# 编写了一个测试以在 IE 11 - Windows 8.1 上运行。
打开 BaseUrl 后什么都不会发生。几秒钟后,我收到一条消息:“错误用户在等待命令完成时关闭了连接”。
我这样定义一个 IE 浏览器:
DesiredCapabilities capabillities = DesiredCapabilities.InternetExplorer();
capabillities.SetCapability(CapabilityType.Platform, "Windows 8.1");
capabillities.SetCapability(CapabilityType.Version, "11");
我开始测试的代码:
driver.Navigate().GoToUrl(baseURL);
driver.FindElement(By.CssSelector("button.btn-xs:nth-child(1)")).Click();
SelectElement selectCountry = new SelectElement (driver.FindElement(By.Id("country")));
selectCountry.SelectByText ("something");
测试的第一个信息是:
desiredCapabilities: {"browserName":"internet explorer"} => {"takesScreenshot":true,"unexpectedAlertBehaviour":"dismiss","ie.browserCommandLineSwitches":"","browserAttachTimeout":0,"ie.ensureCleanSession": false,"ignoreProtectedModeSettings":false,"platform":"WINDOWS","version":"11","ignoreZoomSetting":false,"nativeEvents":true,"handlesAlerts":true,"javascriptEnabled":true,"requireWindowFocus ":false,"ie.usePerProcessProxy":false,"initialBrowserUrl":
"http://localhost:11130/"
,"enableElementCacheCleanup":true,"cssSelectorsEnabled":true,"browserName":"internet explorer","elementScrollBehavior":0,"enablePersistentHover":true,"ie.forceCreateProcessApi":false}
我不知道我做错了什么。Firefox 和 Chrome 的其他测试工作正常。任何想法这里有什么问题?