From a4e5719c30206fb84a1c8d56b3719be2efcc854a Mon Sep 17 00:00:00 2001 From: Marc Fisher Date: Sat, 7 Jan 2017 23:08:20 -0800 Subject: [PATCH] Fixes to FirefoxOptions.java (#3327) * Fixes to FirefoxOptions.java - Remove unneeded check for both prefs and profile being present: According to https://github.com/mozilla/geckodriver/issues/421 having both is valid. - Add getProfile method: Allows for use in intermediate nodes that need to modify the profile e.g. to add additional certs or extensions. * Fix type error. --- .../src/org/openqa/selenium/firefox/FirefoxOptions.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/java/client/src/org/openqa/selenium/firefox/FirefoxOptions.java b/java/client/src/org/openqa/selenium/firefox/FirefoxOptions.java index c893f751c59ca..b04b9a0672361 100644 --- a/java/client/src/org/openqa/selenium/firefox/FirefoxOptions.java +++ b/java/client/src/org/openqa/selenium/firefox/FirefoxOptions.java @@ -136,6 +136,10 @@ public FirefoxOptions setProfile(FirefoxProfile profile) { return this; } + public FirefoxProfile getProfile() { + return this.profile; + } + // Confusing API. Keeping package visible only FirefoxOptions setProfileSafely(FirefoxProfile profile) { if (profile == null) { @@ -183,11 +187,6 @@ public DesiredCapabilities addTo(DesiredCapabilities capabilities) { Object priorProfile = capabilities.getCapability(PROFILE); if (priorProfile != null) { - if (!booleanPrefs.isEmpty() || !intPrefs.isEmpty() || !stringPrefs.isEmpty()) { - throw new IllegalStateException( - "Unable to determine if preferences set on this option " + - "are the same as the profile in the capabilities"); - } if (!priorProfile.equals(profile)) { throw new IllegalStateException( "Profile has been set on both the capabilities and these options, but they're " +