How to work with 2 FireFoxDrivers simultaneously? Does Selenium support multithreading? How to work with 2 FireFoxDrivers simultaneously? Does Selenium support multithreading? selenium selenium

How to work with 2 FireFoxDrivers simultaneously? Does Selenium support multithreading?


Selenium RC/WebDriver is intended to automate a browser. If you want to run multiple tests in parallel, you should look at running your scripts through Selenium Grid/RemoteDriver.


To WebDriver tests in parallel, you need a WebDriver instance per thread. Each instance corresponds to a browser session. Your example should work, as each task creates it's own instance.

You also probably want a test runner that supports parallelization: TestNG for Java, MBunit for .NET.

That said, support multiple webdriver instances differs between browsers:

  • Chrome works great with multiple chrome instances running locally.
  • Firefox has sometimes worked, depending on the version of webdriver and FF
  • IE cannot driver multiple instances locally.

We use run a grid (about 20 remotes) to support parallel execution on all browsers.


TestNG is a very good option to run tests in parallel. We use it for our product automation.