当我尝试页面的简单导航时,IEDriverServer会抛出一个OpenQA.Selenium.WebDriverException。这对于Firefox来说是可行的。
这是“意外错误”,如果我进一步阅读,它似乎是404页找不到。
我已经禁用了所有区域的保护模式,并在InternetExplorerOptions对象上创建了InternetExplorerOptions。
在这种情况下,如何使IE工作呢?
编辑这里是堆栈跟踪:
(在OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)在OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute,Dictionary`2‘2参数(在OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)在OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor,ICapabilities desiredCapabilities(在OpenQA.Selenium.IE.InternetExplorerDriver..ctor(InternetExplorerDriverService服务,InternetExplorerOptions options,TimeSpan commandTimeout) 在OpenQA.Selenium.IE.InternetExplorerDriver..ctor(InternetExplorerDriverService服务,InternetExplorerOptions选项)在CUWebinars.Selenium.Core.Ie.IeTestDriver..ctor() in e:\TTS\BankWebinars\CUWebinars.Selenium.Core\Ie\IeTestDriver.cs:line 21 at CUWebinars.WebUi.Tests.Ie.IeBaseTest.Setup() in e:\TTS\BankWebinars\CUWebinars.WebUi.Tests\Ie\IeBaseTest.cs:line 13
编辑2下面是IeTestDriver (自定义类)的构造函数
const string ieTestDriverLocation = @"E:\";
var internetExplorerDriverService = InternetExplorerDriverService.CreateDefaultService(ieTestDriverLocation);
var internetExplorerOptions = new InternetExplorerOptions();
internetExplorerDriverService.Port = 333; // this is the port for the driver, not the webpage
port = "5556"; // in base class
webDriver = new InternetExplorerDriver(internetExplorerDriverService, internetExplorerOptions); // crashes here
webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
webDriver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));发布于 2014-02-24 06:47:17
为333指定的端口InternetExplorerDriverService位于众所周知的端口号范围内:
在大多数系统上,众所周知的端口号只能由系统(根)进程或特权用户运行的程序使用。
允许驱动程序服务通过不显式指定端口或提供可用端口来选择自己的端口。
双击IEDriverServer.exe将为您提供一条Listening on port <number>消息,以查看它在可用时自动获取的内容。
https://stackoverflow.com/questions/21975241
复制相似问题