Webdriver 3.14 IE11: session lost when click link/

2019-06-08 06:16发布

问题:

My Internet Explorer Options:

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);

When click on link/button that opens an modal popUp, login e password are required on new window (no normal):

while I expect another result window.

If I use ff61, I take the correct window form:

回答1:

I suppose the issue is related to the EnsureCleanSession property. When set this property to true, it will clears the system cache for all instances of Internet Explorer, even those already running when the driven instance is launched.



回答2:

The problem is due at command line –noframemerging used to launch IE.

In fact, this parameter sets IE session between several processes. When I click on the button that opens the popup a new process has been created.

If I use IE in the same manual test, I take only two processes.

I tried to set up

ForceCreateProcessApi = true,
BrowserCommandLineArguments = "-framemerging"

but it doesn't work. For Prevents Internet Explorer from merging new frame processes into new system processes, a workaround is to set this option via registry key:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FrameMerging\(DWORD)00000000

The feature is enabled when the value is set to (DWORD) 00000001 and disabled when the value is (DWORD) 00000000. By default, it is enabled.

Now I'll display the correct popUp window in IE without providing credentials: