Skip to content

Instantly share code, notes, and snippets.

@hdavidzhu
Created September 26, 2016 21:48
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 hdavidzhu/f72d0d93b79ab0ef57950c9a41f72522 to your computer and use it in GitHub Desktop.
Save hdavidzhu/f72d0d93b79ab0ef57950c9a41f72522 to your computer and use it in GitHub Desktop.
20160926-setup.coffee
# Load the Chrome extension and convert to base64 format.
# This is specific to how the node-selenium webdriver sets up its capabilities.
# Refer to http://stackoverflow.com/a/27278322/2204868 for more info.
data = fs.readFileSync '/tmp/location/of/extension.crx'
encodedExtension = data.toString 'base64'
capabilities =
browserName: 'chrome'
chromeOptions:
extensions: [encodedExtension] # This needs to be a base64 String array of our extensions.
# This is the driver you can now use to power all of your tests.
@driver = new webdriver
.Builder()
.withCapabilities(capabilities)
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment