Skip to content

Instantly share code, notes, and snippets.

@AllenFang
Last active May 30, 2019 21:20
Show Gist options
  • Save AllenFang/1cd424b783fbb99e9ea20867e472bfc1 to your computer and use it in GitHub Desktop.
Save AllenFang/1cd424b783fbb99e9ea20867e472bfc1 to your computer and use it in GitHub Desktop.
import webdriver from 'selenium-webdriver';
import firefox from 'selenium-webdriver/firefox';
const XPI_PATH = ... // xpi file path
const firefoxOption = new firefox.Options();
firefoxOption.setPreference('xpinstall.signatures.required', false);
firefoxOption.setBinary(firefox.Channel.AURORA); // Set Developer Edition
const driver = new webdriver.Builder()
.forBrowser('firefox')
.setFirefoxOptions(firefoxOption)
.build();
(async function() {
await driver.installAddon(XPI_PATH);
})();
// You can start work with driver now...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment