Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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_, ""); }

   // go to last window handle in list = the one launched by the login click
   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:

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.

share|improve this answer
I'll accept once I write the C# code for this and get it working – MacGyver Feb 24 '12 at 23:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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