MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / setPreference

Method setPreference

javascript/selenium-webdriver/firefox.js:333–344  ·  view source on GitHub ↗

* @param {string} key the preference key. * @param {(string|number|boolean)} value the preference value. * @return {!Options} A self reference. * @throws {TypeError} if either the key or value has an invalid type.

(key, value)

Source from the content-addressed store, hash-verified

331 * @throws {TypeError} if either the key or value has an invalid type.
332 */
333 setPreference(key, value) {
334 if (typeof key !== 'string') {
335 throw TypeError(`key must be a string, but got ${typeof key}`)
336 }
337 if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') {
338 throw TypeError(`value must be a string, number, or boolean, but got ${typeof value}`)
339 }
340 let options = this.firefoxOptions_()
341 options.prefs = options.prefs || {}
342 options.prefs[key] = value
343 return this
344 }
345
346 /**
347 * Sets the path to an existing profile to use as a template for new browser

Callers 2

constructorMethod · 0.95
options_test.jsFile · 0.45

Calls 1

firefoxOptions_Method · 0.95

Tested by

no test coverage detected