Testing with a selenium driver in Java without opening any browser

Go with PhantomJS but if running them in chromedriver is required and you have the resources, this blog has a good recipe on running headless selenium with chrome. Requiring you to download the following...

  • VirtualBox
  • Vagrant
  • NodeJS

If you plan to implement Jenkins or any other CI in the future, I strongly suggest going with PhantomJS though.


In selenium web driver there is headless mode. so in headless mode you can do the automation without opening the web browser. and also you can deploy your application in none gui system

    ChromeOptions options = new ChromeOptions();
    // setting headless mode to true.. so there isn't any ui
    options.setHeadless(true);

    // Create a new instance of the Chrome driver
    WebDriver driver = new ChromeDriver(options);

GhostDriver and PhantomJS should let you do what you want.