How to open a new tab with Selenium
Until recently, you could open a new tab via
window.open when using
execute_script in Selenium tests. It no longer works in Chrome (will show a "popup blocked" notification).
This is because browsers usually block
window.open unless the user interacted with an element for security reasons. I am not sure why it did work via Selenium before.
Here is an approach that will insert a link into the page, and have Selenium click it:
Note that the link tag is removed after 1 second. You may or may not want to keep this.