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

Method SetPreference

dotnet/src/webdriver/Firefox/Preferences.cs:40–52  ·  view source on GitHub ↗

Sets a preference. The name of the preference to set. A value give the preference. If the preference already exists in the currently-set list of preferences, the value will be updated. If or are <s

(string key, string value)

Source from the content-addressed store, hash-verified

38 /// <exception cref="ArgumentNullException">If <paramref name="key"/> or <paramref name="value"/> are <see langword="null"/>.</exception>
39 /// <exception cref="ArgumentException">If <paramref name="value"/> is wrapped with double-quotes.</exception>
40 internal void SetPreference(string key, string value)
41 {
42 ArgumentNullException.ThrowIfNull(key);
43
44 ArgumentNullException.ThrowIfNull(value);
45
46 if (IsWrappedAsString(value))
47 {
48 throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Preference values must be plain strings: {0}: {1}", key, value));
49 }
50
51 this.preferences[key] = string.Format(CultureInfo.InvariantCulture, "\"{0}\"", value);
52 }
53
54 /// <summary>
55 /// Sets a preference.

Calls 3

ThrowIfNullMethod · 0.80
FormatMethod · 0.80
ToStringMethod · 0.45