In Edge browser, how can I do window.open() and not keeping session in the new window or tab?

2.1k views Asked by At

Working with Edge browser, I would like to open a new window and/or tab without keeping current window session.

I have it working for Firefox like this: Open new window -> window.open('mySiteURL', '_blank', 'status=no,noopener=yes'); Open new tab -> window.open('mySiteURL', '_blank', 'noopener=yes');

i would like to achieve the same for Edge browser.

2

There are 2 answers

0
AudioBubble On

I would create a buffer of new drivers for every new window or tab you want to open. When you'll have used JS window.open() function, just do driverOfOldWindow.close() and it'll close the previous window. Don't use driverOfOldWindow.quit() cause it'll close all the browser windows, this is not what you may want to do since your WebDriver could have opened other windows that you may want to be still working.

To manage tabs just use the getAllWindowHandles() function and call close() method on the ones you want to close too.

Look here

0
Noa On

IE may create multiple content processes for content in different windows and tabs.

If your application is hosting a webbrowser control which then launches a full IE window, the chances are that your new URL is being requested by another process (iexpore.exe) not your apps process. As a result the request does not have access to session cookies hence the session appears "lost".

(Its worth noting that the multiple iexplore.exe process instances in the same process tree have a means of sharing session cookies with each other).

Opening a new window create a new session