首页 文章

IE11上的Selenium WebDriver

提问于
浏览
11

我使用WebDriver自动化我们的webapp的回归套件,我试图让我的测试脚本与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安装,密钥为HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_BFCACHE . 请注意,FEATURE_BFCACHE子项可能存在也可能不存在,如果不存在,则应创建该子项 . 在此键内,创建一个名为iexplore.exe的值为0的DWORD值 . )

  • 保护模式设置对于所有区域都相同

  • 已禁用增强保护模式 .

但是当我在IE11中执行我的自动化脚本时,它仍然打开浏览器并获得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中执行我的自动化脚本 .

版本细节:

  • selenium-2.41.0

  • InternetExplorerDriver服务器(32位)2.40.0.0

  • Windows 7 - 32位

3 回答

  • 4

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

    您已经提到了所需的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安全设置可能对您有用 .

  • 0

    微软已经发布了IE11网络驱动程序

    http://www.microsoft.com/en-us/download/details.aspx?id=44069

  • 7

    2017年更新:

    case "remote5555iexplorer" => {
        println(" load web-driver: remote5555iexplorer")
    
        val dc = DesiredCapabilities.internetExplorer()
        dc.setJavascriptEnabled(true)
         dc.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true)
        dc.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true)
        dc.setCapability(InternetExplorerDriver.ENABLE_ELEMENT_CACHE_CLEANUP, true)
    
        dc.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
    
        remote = new RemoteWebDriver(new URL("http://localhost:5555/"), dc) 
        //remote = new InternetExplorerDriver(dc)
    
      }
    

    iexplorer:11.0.9.9600.17843更新版本:11.0.20

    libraryDependencies =“org.seleniumhq.selenium”%“selenium-ie-driver”%“3.3.1”

    webdriver:IEDriverServer.exe 3.2.0.0(64位)

    运行webdriver的命令:IEDriverServer.exe / LOG-LEVEL = DEBUG

相关问题