Skip to content

Instantly share code, notes, and snippets.

@rordi
Last active August 20, 2019 15:28
Show Gist options
  • Save rordi/aa791274e4717b0f3a3db37bb1da7905 to your computer and use it in GitHub Desktop.
Save rordi/aa791274e4717b0f3a3db37bb1da7905 to your computer and use it in GitHub Desktop.
Javascript Selenium Web Driver with Chrome Options
const {Builder, By, Capabilities} = require('selenium-webdriver');
let chromeCapabilities = Capabilities.chrome();
let chromeOptions = {
'args': ['--test-type', '--headles', '--incognito', '--window-size=340,750'] // approx. size of an iPhone 5/SE
};
// "chromeOptions" was changed to "goog:chromeOptions" at some point...
chromeCapabilities.set('goog:chromeOptions', chromeOptions);
let driver = await new Builder().forBrowser('chrome').withCapabilities(chromeCapabilities).build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment