Skip to content

Commit

Permalink
Thread profile through to capabilities in firefoxdriver constructors
Browse files Browse the repository at this point in the history
I boggle at how many constructors the firefox driver
has.
  • Loading branch information
shs96c committed Oct 1, 2016
1 parent b97704f commit 2a746cc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ private static FirefoxProfile extractProfile(Capabilities desiredCapabilities,
return profile;
}

static void populateProfile(FirefoxProfile profile, Capabilities capabilities) {
static Capabilities populateProfile(FirefoxProfile profile, Capabilities capabilities) {
if (capabilities == null) {
return;
return capabilities;
}
if (capabilities.getCapability(SUPPORTS_WEB_STORAGE) != null) {
Boolean supportsWebStorage = (Boolean) capabilities.getCapability(SUPPORTS_WEB_STORAGE);
Expand Down Expand Up @@ -208,6 +208,7 @@ static void populateProfile(FirefoxProfile profile, Capabilities capabilities) {
(DesiredCapabilities) capabilities :
new DesiredCapabilities(capabilities);
toReturn.setCapability(FIREFOX_OPTIONS, options);
return toReturn;
}

private static FirefoxBinary getBinary(Capabilities capabilities) {
Expand All @@ -223,17 +224,17 @@ private static FirefoxBinary getBinary(Capabilities capabilities) {
}

public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile) {
this(binary, profile, DesiredCapabilities.firefox());
this(binary, profile, populateProfile(profile, DesiredCapabilities.firefox()));
}

public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile, Capabilities capabilities) {
this(binary, profile, capabilities, null);
this(binary, profile, populateProfile(profile, capabilities), null);
}

public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile,
Capabilities desiredCapabilities, Capabilities requiredCapabilities) {
this(createCommandExecutor(desiredCapabilities, binary, profile),
desiredCapabilities, requiredCapabilities);
this(createCommandExecutor(populateProfile(profile, desiredCapabilities), binary, profile),
populateProfile(profile, desiredCapabilities), requiredCapabilities);
this.binary = binary;
}

Expand Down

0 comments on commit 2a746cc

Please sign in to comment.