【问题标题】:Selenium waitForElementPresent hangs in IE11Selenium waitForElementPresent 在 IE11 中挂起
【发布时间】:2019-04-26 19:28:33
【问题描述】:

我正在尝试通过 Selenium Builder 的记录使用 Selenium Grid 测试一个站点。一切似乎都适用于 Windows 和 Mac 上的 Firefox 和 Chrome,但我在 Windows 7 + IE11 中测试时收到错误消息。

每当我尝试选择某个元素或与之交互时:

Exception: Unable to find element on closed window

我正在等待的 HTML 元素在页面加载后通过 jQuery 加载,并在页面上显示为:

<input id="email" name="username" type="email" autofocus="autofocus">

Selenium Builder Step 在继续之前等待它出现:

{
  "locator": {
    "type": "id",
    "value": "email"
  },
  "type": "waitForElementPresent"
},

从有类似问题的人的各种帖子中,我做了以下尝试和纠正:

  • 确保安全区域在 IE 11 中都相同
  • 确保我没有在任何地方使用任何“FLAKY”选项 (INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS)

我应该以不同的方式访问元素吗?还是我缺少 IE 11 设置?

【问题讨论】:

    标签: selenium selenium-webdriver internet-explorer-11


    【解决方案1】:

    根据 Selenium IE 指南 (https://code.google.com/p/selenium/wiki/InternetExplorerDriver) IE 11 存在一个已知问题,即安全区域即使设置正确也会导致问题。

    最好的选择是从 IE 11 降级到 IE 10 (How to downgrade from Internet Explorer 11 to Internet Explorer 10?)

    这解决了这个问题。

    【讨论】:

      【解决方案2】:

      不久前,使用 Selenium 和 C# 注意到 IE 的这种奇怪行为(不记得是哪个版本): 当一个元素被第二次点击时,整个事情就冻结了。 我的解决方法是跟踪所有点击的元素,以避免重复点击。 这解决了我在使用 IE 时遇到的一些问题。

      希望对你有帮助。

      【讨论】:

        猜你喜欢
        • 2019-02-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-04-12
        • 2015-05-18
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多