首页 > 解决方案 > Multiple IE web-drivers : session lost when click link/button that opens a popup window

问题描述


I run multiple (2) IE web-drivers together.(for user side and admin side tests) When the InternetExplorer WebDriver click on link/button that opens an modal popup, login page are opened on new window (abnormal).


When the ie webdriver popup the window , I can see for a fraction of a second the correct address the browser should load (in URL line) , but immediatly it changed to the login url, and required enter username and password.


I found the same problem in this link, I made the solution there, but I still have not solved the problem, and I get an entry window instead of the expected window. see this screenshot


My InternetExplorerOptions:

 private static InternetExplorerOptions ieOptions = new InternetExplorerOptions
        {
            EnsureCleanSession = true ,
            EnableNativeEvents = true ,
            RequireWindowFocus = true ,
            EnablePersistentHover = true ,
            ForceCreateProcessApi = true ,
            BrowserCommandLineArguments = "-framemerging -private"
        };

I added the registry keys:

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

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

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE\iexplorer.exe\(DWORD)00000000

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE\iexplorer.exe\(DWORD)00000000


Edited:

By the Deepak-MSFT references, I understand that the issue caused by more than one IE web-driver instances.

I tried to kill the IE driver also by adding the ConfirmCleanSession = trueoption to the code, and also manually by running of the following statements from the command line (before running the test);

taskkill / F / IM iexplore.exe / T
taskkill / F / IM IEDriverServer.exe / T


But it did not help once I set 2 IE web-drivers to work together.

(When I tried to run the test only on one driver - it worked great!)


I would appreciate help in solving the problem!

标签: c#seleniumselenium-webdriverwebdriverinternet-explorer-11

解决方案


这个问题是由于 IE 本身的怪癖以及驱动程序如何为浏览器创建弹出窗口。

解决方法是确保在启动与驱动程序的会话时没有运行 iexplore.exe 进程。

参考:

(1)单击使用 window.open() 打开窗口的链接时会话 cookie 丢失

(2)当点击使用 window.open() 打开一个窗口的链接时会话 cookie 丢失


推荐阅读