Selenium multiple tabs at once

Trevor Tiernan picture Trevor Tiernan · Aug 9, 2013 · Viewed 59.5k times · Source

I'm working with Selenium, and am wondering if it's possible to use multiple TABS at once? I do not want to use multiple browser instances (i.e., 2 copies of IE pun). IF IT IS NOT possible, how would one go about switching between individual tabs, that are running sequentially?

Thanks!

Answer

Nathan Merrill picture Nathan Merrill · Aug 9, 2013

If there is a link that opens up a new window/tab, then you can use driver.switchTo().window();

However, if you want to run something on multiple windows, then I recommend having multiple instances of webdriver. It is much easier to manage, and is supported (There are workarounds on opening a new tab/window, such as pressing a hotkey that opens a new window, but they aren't supported).

If you are wanting to have multiple threads all act on the same driver instance, but different tabs, that is NOT possible.