internet-explorer - IE11 上的 Selenium WebDriver

标签 internet-explorer selenium internet-explorer-11

我正在使用 WebDriver 来自动化我们的 web 应用程序的回归套件,我试图让我的测试脚本与 IE11 一起运行,但没有取得任何成功。
我了解 IEDriverServer.exe 目前不支持 WebDriver,该问题需要 Microsoft 的合作,我已尝试响应 Selenium 问题 #6511 中概述的步骤。

  • (仅对于 IE 11,您需要在目标计算机上设置一个注册表项,以便驱动程序可以保持与其创建的 Internet Explorer 实例的连接。对于 32 位 Windows 安装,您必须在注册表中检查该键编辑器是 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE。
    对于 64 位 Windows 安装, key 是 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE。请注意 FEATURE_BFCACHE 子项可能存在也可能不存在,如果不存在则应创建。在此键中,创建一个名为 iexplore.exe 且值为 0 的 DWORD 值。)
  • 所有区域的保护模式设置都相同
  • 增强保护模式已禁用。

  • 但是当我在 IE11 中执行我的自动化脚本时,它仍然打开浏览器并低于异常
    org.openqa.selenium.ElementNotVisibleException: Received a JavaScript error attempting to 
    click on the element using synthetic events.We are assuming this is because the element 
    isn't displayed, but it may be due to other problems with executing JavaScript. (WARNING:
    The server did not provide any stacktrace
    information)
    
    任何人都可以帮助我解决这个问题。我需要在 IE11 中执行我的自动化脚本。
    版本详情:
  • Selenium -2.41.0
  • InternetExplorerDriver 服务器(32 位)2.40.0.0
  • Windows 7 - 32 位
  • 最佳答案

    这有点棘手和烦人,但可能。

    您已经提到了所需的 IE 设置。它还缓存运行/使用之间的内容,您必须清除缓存和个人设置。我发现以下内容有助于确保实例在启动时是干净的。这些是在实例化 WebDriver 时将传递到 IE 实例的选项。

    本地的:

        var options = new InternetExplorerOptions();
        options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
        //Clean the session before launching the browser
        options.EnsureCleanSession = true;
    

    偏僻的:
        capabilities = DesiredCapabilities.InternetExplorer();
        capabilities.SetCapability("ie.ensureCleanSession", true);
    

    也许这以及您提到的 IE 安全设​​置可能对您有用。

    关于internet-explorer - IE11 上的 Selenium WebDriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23782891/

    相关文章:

    javascript - 在 IE 中浏览字符串

    javascript - json.stringify 没有在主对象下的所有对象上调用 toJson

    java - 远程运行自动化测试AutoitX无法移动鼠标或发送按键

    css - 将浏览器特定条件放入 CSS 选择器

    python - 计算机 sleep 后如何恢复 Selenium RC 测试?

    python - 调用 ActionChains move_to_element() 会导致属性错误?

    html - 自动边距扩展在 IE11 的 flexbox 内不起作用

    Angular4 : *ngIf in not hiding element, 而不是在 Internet Explorer 11 中创建重复元素

    windows - Internet Explorer 忽略 flash mms.cfg 设置

    html - Firefox、Edge 和 IE 中的 Flexbox column-reverse