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.
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 usedriverOfOldWindow.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 callclose()
method on the ones you want to close too.Look here