Skip to content

Instantly share code, notes, and snippets.

@gomo
Created June 21, 2017 04:47
Show Gist options
  • Save gomo/4ccd61095388c39d813bfbcd2bdcb3f3 to your computer and use it in GitHub Desktop.
Save gomo/4ccd61095388c39d813bfbcd2bdcb3f3 to your computer and use it in GitHub Desktop.
Javascript selenium with headless chrome
import webdriver from 'selenium-webdriver'
import test from 'selenium-webdriver/testing'
test.describe('Test', () => {
test.it('with headless chrome.', () => {
const chromeCapabilities = webdriver.Capabilities.chrome();
chromeCapabilities.set('chromeOptions', {
'args': ['--headless', '--disable-gpu']
});
driver = new webdriver.Builder()
.usingServer('http://localhost:4444/wd/hub')
.withCapabilities(chromeCapabilities)
.build();
driver.get('http://www.google.com/');
driver.quit();
})
})
@RobertGary1
Copy link

Interesting. When I do this Chrome still pops up.

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