Geek Culture

A new tech publication by Start it up (https://medium.com/swlh).

Follow publication

Member-only story

Headless Browser Testing Clarified

Zhimin Zhan
Geek Culture
Published in
8 min readSep 20, 2021

This article is one of the “IT Terminology Clarified” series.

Headless Browser Testing is a way of running browser tests without the UI (head, a term from Unix). Let’s have a look at a Selenium test execution in headless mode as well as a normal mode for comparison.

Demo: Headless vs Normal

Firstly, normal selenium test execution with browser UI.

Run a Selenium Rspec tests in TestWise IDE

Then the same test is run in headless mode.

Turn on the headless setting in TestWise, and rerun the same test

As you can see, there is no Chrome browser shown during the second test execution and the test still passed. This is headless testing.

History of Headless Browser Testing

Between 2010–2015, Headless browser testing with Phantom JS was hyped highly by test architects/engineers. I tried and was puzzled on how it could possibly work. I wrote down my suggestion to avoid headless testing with Phantom JS in my book “Selenium WebDriver Recipes in Ruby”.

In 2017, Phantom JS was deprecated. According to Vitaly Slobodin, the main maintainer: “(Headless) Chrome is faster and more stable than PhantomJS. And it doesn’t eat memory like crazy. I don’t see any future in developing PhantomJS.” It turned out that those ‘we did headless testing with Phantom JS’ were just lies. (if the test automation framework is not reliable, ….)

Chrome v59 (released in June 2017) introduced its headless mode. Here I mean real headless.

How to start Chrome in headless mode?

old way:

options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('headless')
driver = Selenium::WebDriver.for :chrome, :options => options

New way:

options = Selenium::WebDriver::Chrome::Options.new…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Zhimin Zhan
Zhimin Zhan

Written by Zhimin Zhan

Test automation & CT coach, author, speaker and award-winning software developer. Help teams succeed with Agile/DevOps by implementing real Continuous Testing.

Responses (2)

Write a response

Optimize Selenium WebDriver Automated Test Scripts: Speed

The url looks broken

Thanks for sharing it, pretty useful