MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / setPreference

Method setPreference

javascript/selenium-webdriver/firefox.js:332–343  ·  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

330 * @throws {TypeError} if either the key or value has an invalid type.
331 */
332 setPreference(key, value) {
333 if (typeof key !== 'string') {
334 throw TypeError(`key must be a string, but got ${typeof key}`)
335 }
336 if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') {
337 throw TypeError(`value must be a string, number, or boolean, but got ${typeof value}`)
338 }
339 let options = this.firefoxOptions_()
340 options.prefs = options.prefs || {}
341 options.prefs[key] = value
342 return this
343 }
344
345 /**
346 * 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