Skip to content

Instantly share code, notes, and snippets.

@remarkablemark
Created March 1, 2016 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remarkablemark/b317344af07546752611 to your computer and use it in GitHub Desktop.
Save remarkablemark/b317344af07546752611 to your computer and use it in GitHub Desktop.
WebDriverJS recipes
'use strict';
/**
* Module dependencies.
*/
var webdriver = require('selenium-webdriver');
var chrome = require('selenium-webdriver/chrome');
/**
* Chrome options.
*/
var chromeOptions = new chrome.Options();
// if profile exists, then use it
// otherwise, create new profile
var chromeProfilePath = './ChromeProfile/';
chromeOptions.addArguments(['user-data-dir=' + chromeProfilePath]);
/**
* Build driver with options.
*/
var driver = new webdriver.Builder().withCapabilities(chromeOptions).build();
// confirm profile path
driver.get('chrome://version');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment