Skip to content

Instantly share code, notes, and snippets.

@christian-bromann
Last active August 8, 2017 22:04
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save christian-bromann/f2edc847a12684a9505589b061f0a557 to your computer and use it in GitHub Desktop.
Save christian-bromann/f2edc847a12684a9505589b061f0a557 to your computer and use it in GitHub Desktop.
Run Chrome headless

Run Chrome headless

The good old PhantomJS times are over. The project is not maintained anymore and it is recommended to switch over to Chrome headless. Just run a local Selenium standalone server:

$ java -jar Sites/selenium-server-standalone-3.4.0.jar

and run a test with the config below. This is tested with Mac OS X and Windows 10. If you have more questions, join our Gitter for support.

describe('runs in headless Chrome', () => {
it('opens website without browser window', () => {
browser.url("http://webdriver.io")
console.log(browser.getTitle())
})
});
var readline = require('readline')
var hasTriggered = false
exports.config = {
specs: ['./test.spec.js'],
capabilities: [{
browserName: 'chrome',
chromeOptions: {
// run in headless mode
args: ['--headless'],
// point to your Canary version as it is only supported there
binary: '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'
}
}],
framework: 'mocha',
mochaOpts: {
timeout: 10000
}
}
@igorroman777
Copy link

but only for chrome 49?

@igorroman777
Copy link

sorry 59?

@igorroman777
Copy link

https://developers.google.com/web/updates/2017/04/headless-chrome
"Headless Chrome is shipping in Chrome 59. It's a way to run the Chrome browser in a ..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment