我正在使用 WebDriver 来自动化我们的 web 应用程序的回归套件,我试图让我的测试脚本与 IE11 一起运行,但没有取得任何成功。
我了解 IEDriverServer.exe 目前不支持 WebDriver,该问题需要 Microsoft 的合作,我已尝试响应 Selenium 问题 #6511 中概述的步骤。
对于 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 中执行我的自动化脚本。版本详情:
最佳答案
这有点棘手和烦人,但可能。
您已经提到了所需的 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/