首页 > 解决方案 > Webdriver 3.14 IE11:单击打开窗口/弹出窗口的链接/按钮时会话丢失

问题描述

我的 Internet Explorer 选项:

var optionsIE = new InternetExplorerOptions();                        
optionsIE.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
optionsIE.EnsureCleanSession = true;

string IE_DRIVER_PATH = SolutionDirectory + @"\\..\\packages\\Selenium.WebDriver.IEDriver.3.14.0\\driver\\";

InternetExplorerDriverService service =
InternetExplorerDriverService.CreateDefaultService(IE_DRIVER_PATH);
service.Port = port; 
driver = new InternetExplorerDriver(service, optionsIE);

单击打开模式弹出窗口的链接/按钮时,在新窗口上需要登录 e 密码(不正常):

在此处输入图像描述

而我期待另一个结果窗口。

如果我使用 ff61,我会采用正确的窗口形式:

在此处输入图像描述

标签: sessionmodal-dialogwebdriverpopupinternet-explorer-11

解决方案


我想这个问题与EnsureCleanSession 属性有关。当将此属性设置为 true 时,它​​将清除 Internet Explorer 的所有实例的系统缓存,即使是那些在驱动实例启动时已经运行的实例。


推荐阅读