I've researched this to some extent already by searching StackOverflow and SQA, but cannot find the answer.

Is it possible to open a new WebDriver browser window from the current FirefoxDriver (IWebDriver) instance, or do I need to instantiate a new FirefoxDriver instance? It would be nice to open a new tab, but I read that this is not possible with WebDriver.

The [hidden] part of my question .. bonus if you know, but not required. :-)

And also, I don't even need to see this browser window, so I'd prefer that it's hidden. Does the browser need to be seen or can I do the webdriver tests without having the task/browser open in Windows?

1 Answer 1


Yes, you can interact with a window that is spawned as part of the automated test with this code:

void startSelenium() 
   driver_ = new FirefoxDriver();
   selenium_ = new WebDriverBackedSelenium(driver_,
 for (String handle : driver_.getWindowHandles())
      System.out.println("win " + handle);
      System.out.println("href: " + selenium_.getLocation());

I haven't tested this code, I got it from this page along with additional info: http://osdir.com/ml/selenium-users/2011-04/msg00440.html

For the second question about a hidden browser, I would suggest using the HTMLUnit driver. This would also solve any issues with simultaneous interaction with both windows.

  • I'll accept once I write the C# code for this and get it working Commented Feb 24, 2012 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.