IE11 上的 Selenium WebDriver [英] Selenium WebDriver on IE11

查看:37
本文介绍了IE11 上的 Selenium WebDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WebDriver 来自动化我们的 web 应用程序的回归套件,我试图让我的测试脚本与 IE11 一起运行,但没有任何成功.

I am using WebDriver for automating regression suite of our webapp, I have tried to get my test scripts functioning with IE11 but have not had any success.

我了解 IEDriverServer.exe 目前不支持 WebDriver,该问题需要 Microsoft 的合作,我已尝试响应 Selenium 问题 #6511 中概述的步骤.

I understand IEDriverServer.exe does not currently support WebDriver and the issue requires cooperation from Microsoft, I have tried the steps outlined in responses to Selenium issue #6511.

  1. (仅对于 IE 11,您需要在目标计算机上设置一个注册表项,以便驱动程序可以保持与其创建的 Internet Explorer 实例的连接.对于 32 位 Windows 安装,密钥您必须在注册表编辑器中检查 HKEY_LOCAL_MACHINESOFTWAREMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE.

  1. (For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINESOFTWAREMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE.

对于 64 位 Windows 安装,密钥是 HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE.请注意 FEATURE_BFCACHE 子项可能存在也可能不存在,如果不存在则应创建.在这个键中,创建一个名为 iexplore.exe 的 DWORD 值,值为 0.)

For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Inside this key, create a DWORD value named iexplore.exe with the value of 0.)

所有区域的保护模式设置都相同

Protected mode settings are the same for all zones

增强保护模式已禁用.

但是当我在 IE11 中执行我的自动化脚本时,它仍然打开浏览器并低于异常

But still when I execute my automation scripts in IE11, It is opening browser and getting below Exception

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 中执行我的自动化脚本.

Can anyone please help me in how to solve this issue. I need to execute my automation scripts in IE11.

版本详情:

  1. selenium-2.41.0

  1. selenium-2.41.0

InternetExplorerDriver 服务器(32 位)2.40.0.0

InternetExplorerDriver server (32-bit) 2.40.0.0

Windows 7 - 32 位

Windows 7 - 32 bit

推荐答案

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

It is a little bit tricky and annoying, but possible.

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

You already mentioned the IE settings that are needed. It also cache's the content between runs/usage and you would have to clear the cache and personal settings. I have found that the following helps ensure that the instance is clean when starting. These are options that will be passed into the IE instance when instantiating the WebDriver.

本地:

    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 安全设​​置可能对您有用.

Perhaps this as well as the IE security settings you mentioned might work for you.

这篇关于IE11 上的 Selenium WebDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆