@@ -70,7 +70,7 @@ public FirefoxProfile() {
70
70
* Constructs a firefox profile from an existing profile directory.
71
71
* <p>
72
72
* Users who need this functionality should consider using a named profile.
73
- *
73
+ *
74
74
* @param profileDir The profile directory to use as a model.
75
75
*/
76
76
public FirefoxProfile (File profileDir ) {
@@ -143,10 +143,26 @@ private boolean getBooleanPreference(Preferences prefs, String key, boolean defa
143
143
throw new WebDriverException ("Expected boolean value is not a boolean. It is: " + value );
144
144
}
145
145
146
+ public String getStringPreference (String key , String defaultValue ) {
147
+ Object preference = additionalPrefs .getPreference (key );
148
+ if (preference != null && preference instanceof String ){
149
+ return (String ) preference ;
150
+ }
151
+ return defaultValue ;
152
+ }
153
+
146
154
public int getIntegerPreference (String key , int defaultValue ) {
147
- Object preference =additionalPrefs .getPreference (key );
148
- if (preference !=null && preference instanceof Integer ){
149
- return (Integer )preference ;
155
+ Object preference = additionalPrefs .getPreference (key );
156
+ if (preference != null && preference instanceof Integer ){
157
+ return (Integer ) preference ;
158
+ }
159
+ return defaultValue ;
160
+ }
161
+
162
+ public boolean getBooleanPreference (String key , boolean defaultValue ) {
163
+ Object preference = additionalPrefs .getPreference (key );
164
+ if (preference != null && preference instanceof Boolean ){
165
+ return (Boolean ) preference ;
150
166
}
151
167
return defaultValue ;
152
168
}
@@ -184,7 +200,7 @@ public void addExtension(Class<?> loadResourcesUsing, String loadFrom) throws IO
184
200
185
201
/**
186
202
* Attempt to add an extension to install into this instance.
187
- *
203
+ *
188
204
* @param extensionToInstall
189
205
* @throws IOException
190
206
*/
@@ -210,7 +226,7 @@ private String deriveExtensionName(String originalName) {
210
226
* Note that if a value looks as if it is a quoted string (that is, starts with a quote character
211
227
* and ends with one too) an IllegalArgumentException is thrown: Firefox fails to start properly
212
228
* when some values are set to this.
213
- *
229
+ *
214
230
* @param key The key
215
231
* @param value The new value.
216
232
*/
@@ -220,7 +236,7 @@ public void setPreference(String key, String value) {
220
236
221
237
/**
222
238
* Set a preference for this particular profile.
223
- *
239
+ *
224
240
* @param key The key
225
241
* @param value The new value.
226
242
*/
@@ -230,7 +246,7 @@ public void setPreference(String key, boolean value) {
230
246
231
247
/**
232
248
* Set a preference for this particular profile.
233
- *
249
+ *
234
250
* @param key The key
235
251
* @param value The new value.
236
252
*/
@@ -315,7 +331,7 @@ public void setEnableNativeEvents(boolean enableNativeEvents) {
315
331
/**
316
332
* Returns whether the no focus library should be loaded for Firefox profiles launched on Linux,
317
333
* even if native events are disabled.
318
- *
334
+ *
319
335
* @return Whether the no focus library should always be loaded for Firefox on Linux.
320
336
*/
321
337
public boolean shouldLoadNoFocusLib () {
@@ -324,7 +340,7 @@ public boolean shouldLoadNoFocusLib() {
324
340
325
341
/**
326
342
* Sets whether the no focus library should always be loaded on Linux.
327
- *
343
+ *
328
344
* @param loadNoFocusLib Whether to always load the no focus library.
329
345
*/
330
346
public void setAlwaysLoadNoFocusLib (boolean loadNoFocusLib ) {
@@ -334,7 +350,7 @@ public void setAlwaysLoadNoFocusLib(boolean loadNoFocusLib) {
334
350
/**
335
351
* Sets whether Firefox should accept SSL certificates which have expired, signed by an unknown
336
352
* authority or are generally untrusted. This is set to true by default.
337
- *
353
+ *
338
354
* @param acceptUntrustedSsl Whether untrusted SSL certificates should be accepted.
339
355
*/
340
356
@@ -353,7 +369,7 @@ public void setAcceptUntrustedCertificates(boolean acceptUntrustedSsl) {
353
369
* If you are receive an "untrusted site" prompt on Firefox when using a certificate that was
354
370
* issued by valid issuer, but has expired or is being served served for a different host (e.g.
355
371
* production certificate served in a testing environment) set this to false.
356
- *
372
+ *
357
373
* @param untrustedIssuer whether to assume untrusted issuer or not.
358
374
*/
359
375
public void setAssumeUntrustedCertificateIssuer (boolean untrustedIssuer ) {
@@ -386,10 +402,10 @@ protected void cleanTemporaryModel() {
386
402
* Call this to cause the current profile to be written to disk. The profile directory is
387
403
* returned. Note that this profile directory is a temporary one and will be deleted when the JVM
388
404
* exists (at the latest)
389
- *
405
+ *
390
406
* This method should be called immediately before starting to use the profile and should only be
391
407
* called once per instance of the {@link org.openqa.selenium.firefox.FirefoxDriver}.
392
- *
408
+ *
393
409
* @return The directory containing the profile.
394
410
*/
395
411
public File layoutOnDisk () {
0 commit comments