Surely someone else has run into this problem. I'm trying to figure out how to loop through Firefox, Chrome, and IE in conjunction with nose.

Right now I have:

  • "setup.cfg" file that specifies browsers
  • a "common.py" that reads from the config file
  • my actual "test.py" files that imports "common.py" and can reference global variables in it

The main trouble seems to be how to pass in the browser/driver into the setUp methods of the unittest.TestCase class.

One possible solution is to sub-class, and have a class for each browser. In that case I'm duplicating my test code three times, though, which is ugly.

Another possibility is to run nose in code. But I'm unsure how I would read the arguments from it inside my files.

  • Even i have this issue, @aaron.
    – Alagu
    Nov 5, 2011 at 3:32
  • 2
    What I ended up going was making a setup.cfg that my imported module reads from. It has a line to specify the browser. What I can do then is run nosetests each time after I changed the browser (the .cfg could be changed at the end of the tests in an autoamated fashion, of course). This doesn't really solve the problem, but it's at least more elegant than writing three test functions for each test, or doing something weird like copying the test folder three times.
    – Aaron
    Nov 7, 2011 at 18:28
  • @AaronShaver if that is your answer you may want to put it in the answer section and accept it.
    – Dan Snell
    Jun 19, 2012 at 2:49

1 Answer 1


Did you try using selenose? (this is the online document) I think this library might be the one fit you. It has something like this in setup.cfg:


with-selenium-driver = true

selenium-driver = firefox


webdriver = firefox


webdriver = chrome

so, you can use command to run test like this:

nosetest --with-selenium-driver --selenium-driver=firefox

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.