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

Method setPreference

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

235 * @throws {TypeError} if either the key or value has an invalid type.
236 */
237 setPreference(key, value) {
238 if (typeof key !== 'string') {
239 throw TypeError(`key must be a string, but got ${typeof key}`)
240 }
241 if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') {
242 throw TypeError(`value must be a string, number, or boolean, but got ${typeof value}`)
243 }
244 let options = this.firefoxOptions_()
245 options.prefs = options.prefs || {}
246 options.prefs[key] = value
247 return this
248 }
249
250 /**
251 * 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