Selenium – Does Selenium support headless browser testing

automated-testsheadless-browserseleniumselenium-webdriverunit testing

I'm looking at Selenium Server at the moment, and I don't seem to notice a driver that supports headless browser testing.

Unless I'm mistaken, it doesn't support it. If you're on X, you can create a virtual framebuffer to hide the browser window, but that's not really a headless browser.

Can anyone enlighten me? Does Selenium support headless browser testing?

Best Answer

you need not use PhantomJS as an alternative to Selenium. Selenium includes a PhantomJS webdriver class, which rides on the GhostDriver platform. Simply install the PhantomJS binary to your machine. in python, you can then use:

from selenium import webdriver
dr = webdriver.PhantomJS() 

and voila.