我更新了我的项目以使用Selenium 3.0.0-beta2和Geckodriver而不是FirefoxDriver的遗留实现。在所有其他浏览器中,我的所有测试仍然可以正常运行,但我尝试在Gecko中执行的所有测试方法和所有FindElement操作都会引发异常:
WebDriverException:对URL http://localhost:28957/session/17e03419-11f5-417f-be98-11d323f72a6a/elements的远程WebDriver服务器的HTTP请求在10秒后超时。
当我使用Gecko启动FirefoxDriver的新实例时,某些方法仍可正常运行,例如导航到其他窗口并执行javascript。
我的驱动程序设置:
private static void SetupFirefoxDriver()
{
var driverService = FirefoxDriverService.CreateDefaultService(DriversPath, "geckodriver.exe");
driverService.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\Firefox.exe";
driverService.HideCommandPromptWindow = true;
driverService.SuppressInitialDiagnosticInformation = true;
var option = new FirefoxOptions();
option.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true);
option.AddAdditionalCapability("browser.download.folderList", 2);
option.AddAdditionalCapability("browser.download.dir", Config.DiretorioDeDownload);
option.AddAdditionalCapability("browser.download.downloadDir", Config.DiretorioDeDownload);
option.AddAdditionalCapability("browser.download.defaultFolder", Config.DiretorioDeDownload);
option.AddAdditionalCapability("browser.helperApps.neverAsk.saveToDisk", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/csv, application/pdf, application/octet-stream");
SeleniumWebDriver.Driver = new FirefoxDriver(driverService, option, TimeSpan.FromSeconds(10));
}
我的配置:
答案 0 :(得分:0)