TestProject Forum
Powered by leading experts in the test automation community

Selenium testing without browser popping up

Is there a way to run selenium automated tests without opening a browser ?
suppose i wanted to run multiple tests at once.

It is possible, but not with the standard firefox driver / chrome / etc.

You would need to install PhantomJS.
just assign your WebDriver to an instance of phantomJS driver :

driver = webdriver.PhantomJS()

If you run your code now, no browser window will be opened.

You can also use HTMLUnitDriver, which also does not open a browser window.

Using selenium grid is another option. With selenium grid you could launch a browser on a different machine or VM.

Thanks guys. PhantomJS is good enough at the moment. perhaps at a later stage i’d need to run on a few more machines