Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

Is it possible to do automated browser testing with Selenium/WebdriverIO using Chrome in headless mode?

Supposedly Chrome --headless is a thing now, but I can't get their example working. I was hoping Selenium had an option for this?

I'm initializing WebdriverIO like so:

const WebdriverIO = require('webdriverio');

let driver = WebdriverIO.remote({

    desiredCapabilities: {

        browserName: browser, // "chrome" or "firefox"



And I'm starting Selenium using selenium-standalone: 

selenium-standalone start > /dev/null 2>&1

1 Answer

0 votes
by (62.9k points)


Here is a working example with WebdriverIO:

The basic idea:

 import * as webdriverio from 'webdriverio';

// Headless is supported in Chrome >= 58. Not currently stable, so using dev

// build.

const CHROME_BIN_PATH = '/Applications/Google Chrome Chrome';

const options = {

    desiredCapabilities: {

        browserName: 'chrome',

        chromeOptions: {

            binary: CHROME_BIN_PATH,

            args: [


               //Use --disable-gpu to include Mesa library, as per











    .getTitle().then(title => {

        console.log({ title });



If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s selenium course online

Browse Categories