Last active
June 29, 2019 05:48
-
-
Save nombrekeff/dc2b118ab76e899f3352da717f7306a8 to your computer and use it in GitHub Desktop.
selenium-webdriver .setPreference is not a function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Builder } = require('selenium-webdriver'); // Currently using ^3.6.0 | |
const firefox = require('selenium-webdriver/firefox'); // Currently using ^3.6.0 | |
// Create a builder for browser 'firefox' | |
let builder = new Builder().forBrowser('firefox'); | |
// I then create firefox options | |
let options = new firefox.Options(); | |
// setPreference is present in the docs as well as the type file for this version | |
// But is present in this docs: https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/firefox_exports_Options.html | |
// will fail: TypeError: options.setPreference is not a function | |
options.setPreference('lightweightThemes.selectedThemeID', 'default-theme@mozilla.org'); | |
// Then I build it | |
builder.setFirefoxOptions(options); | |
builder.build(); | |
// Running it: node test.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setting the profile was as simple as doing: