gpt4 book ai didi

java - Selenium IE WebDriver 在测试后不关闭/退出

转载 作者:行者123 更新时间:2023-11-30 08:10:13 25 4
gpt4 key购买 nike

我正在为 IE11 运行 selenium 测试,但在测试后它不会关闭 IE,即使我使用了 quit() 或 close()。我的代码如下:

        System.setProperty("webdriver.ie.driver", "C:\\selenium\\drivers\\IEDriverServer.exe");
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability("ignoreZoomSetting", true);
caps.setCapability("nativeEvents", false);
driver = new InternetExplorerDriver(caps);
//test steps
driver.quit();

有什么想法吗?谢谢。

最佳答案

  • On IE 7 or higher on Windows Vista or Windows 7, you must set theProtected Mode settings for each zone to be the same value. The valuecan be on or off, as long as it is the same for every zone. To set theProtected Mode settings, choose "Internet Options..." from the Toolsmenu, and click on the Security tab. For each zone, there will be acheck box at the bottom of the tab labeled "Enable Protected Mode".

  • Additionally, "Enhanced Protected Mode" must be disabled for IE 10 andhigher. This option is found in the Advanced tab of the InternetOptions dialog.

  • The browser zoom level must be set to 100% so that thenative mouse events can be set to the correct coordinates.

  • For IE 11 only, you will need to set a registry entry on the targetcomputer so that the driver can maintain a connection to the instanceof Internet Explorer it creates. For 32-bit Windows installations, thekey you must examine in the registry editor isHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InternetExplorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windowsinstallations, the key isHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\InternetExplorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that theFEATURE_BFCACHE subkey may or may not be present, and should becreated if it is not present. Important: Inside this key, create aDWORD value named iexplore.exe with the value of 0

来源:https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration

关于java - Selenium IE WebDriver 在测试后不关闭/退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31858717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com