【问题标题】:Selenium and a Non-working IEDriverServerSelenium 和不工作的 IEDriverServer
【发布时间】:2014-02-23 22:02:46
【问题描述】:

当我尝试简单导航到页面时,IEDriverServer 正在抛出 OpenQA.Selenium.WebDriverException。这适用于 Firefox。

这是“意外错误”,如果我进一步阅读,它似乎是找不到 404 页面。

我已经为所有区域禁用了保护模式,并且还在 InternetExplorerOptions 对象上创建了 IntroduceInstabilityByIgnoringProtectedModeSettings = true。

在这种情况下如何让 IE 工作?

编辑 这是堆栈跟踪:

在 OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(响应 错误响应)在 OpenQA.Selenium.Remote.RemoteWebDriver.Execute(字符串 driverCommandToExecute,Dictionary`2 参数)在 OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities 所需能力)在 OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor,ICapabilities 期望能力)在 OpenQA.Selenium.IE.InternetExplorerDriver..ctor(InternetExplorerDriverService 服务、InternetExplorerOptions 选项、TimeSpan 命令Timeout)
在 OpenQA.Selenium.IE.InternetExplorerDriver..ctor(InternetExplorerDriverService 服务,InternetExplorerOptions 选项)在 CUWebinars.Selenium.Core.Ie.IeTestDriver..ctor() 在 e:\TTS\BankWebinars\CUWebinars.Selenium.Core\Ie\IeTestDriver.cs:line 21 在 CUWebinars.WebUi.Tests.Ie.IeBaseTest.Setup() 中 e:\TTS\BankWebinars\CUWebinars.WebUi.Tests\Ie\IeBaseTest.cs:第 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));

【问题讨论】:

  • @user1177636 我已编辑问题以添加堆栈跟踪。请注意,我为所有区域启用了保护,并且正在使用 IE 11。
  • 向我们展示您失败的代码。您尝试浏览的 URL 是什么?您是否在网址前添加了 http:// 前缀?
  • @Faiz 在到达导航代码之前就崩溃了。它在更新 InternetExplorerDriver 对象时崩溃。请参阅有问题的编辑。
  • @user1177636 请注意,Chrome 版本的 webdriver 也会崩溃。
  • @onefootswill: 我的最后一个建议 :) 尝试使用不同的端口(例如:5555),或者不指定一个,因为端口 333 属于 众所周知的端口范围。如果你 dbl-click IEDriverServer.exe,它应该会给你一个 Listening on port 消息(至少检查 IEDriverServer 是否工作)。

标签: selenium


【解决方案1】:

为InternetExplorerDriverService 指定的端口333 在well-known-port-numbers 范围内:

在大多数系统上,众所周知的端口号只能由系统使用 (根)进程或由特权用户运行的程序。

允许驱动程序服务通过不明确指定端口来选择自己的端口,或提供可用端口。

双击 IEDriverServer.exe 会给您一个Listening on port <number> 消息,以查看它自动选择的可用内容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-29
    • 1970-01-01
    • 1970-01-01
    • 2012-01-02
    相关资源
    最近更新 更多