Skip to content

Commit

Permalink
Fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Aug 29, 2017
1 parent 4a33dfa commit 3528c0c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
24 changes: 12 additions & 12 deletions java/client/test/org/openqa/selenium/firefox/FirefoxDriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void canStartDriverWithSpecifiedProfile() {
profile.setPreference("browser.startup.page", 1);
profile.setPreference("browser.startup.homepage", pages.xhtmlTestPage);

localDriver = new FirefoxDriver(profile);
localDriver = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
wait.until($ -> "XHTML Test Page".equals(localDriver.getTitle()));
}

Expand Down Expand Up @@ -266,7 +266,7 @@ public void shouldBeAbleToStartFromAUniqueProfile() {
FirefoxProfile profile = new FirefoxProfile();

try {
WebDriver secondDriver = new FirefoxDriver(profile);
WebDriver secondDriver = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
secondDriver.quit();
} catch (Exception e) {
e.printStackTrace();
Expand All @@ -280,7 +280,7 @@ public void aNewProfileShouldAllowSettingAdditionalParameters() {
profile.setPreference("browser.startup.homepage", pages.formPage);

try {
WebDriver secondDriver = new FirefoxDriver(profile);
WebDriver secondDriver = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
new WebDriverWait(secondDriver, 30).until(titleIs("We Leave From Here"));
String title = secondDriver.getTitle();
secondDriver.quit();
Expand All @@ -301,7 +301,7 @@ public void shouldBeAbleToStartFromProfileWithLogFileSet() throws IOException {
profile.setPreference("webdriver.log.file", logFile.getAbsolutePath());

try {
WebDriver secondDriver = new FirefoxDriver(profile);
WebDriver secondDriver = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
assertTrue("log file should exist", logFile.exists());
secondDriver.quit();
} catch (Exception e) {
Expand All @@ -317,7 +317,7 @@ public void shouldBeAbleToStartFromProfileWithLogFileSetToStdout() throws IOExce
profile.setPreference("webdriver.log.file", "/dev/stdout");

try {
WebDriver secondDriver = new FirefoxDriver(profile);
WebDriver secondDriver = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
secondDriver.quit();
} catch (Exception e) {
e.printStackTrace();
Expand All @@ -330,7 +330,7 @@ public void shouldBeAbleToStartANamedProfile() {
FirefoxProfile profile = new ProfilesIni().getProfile("default");
assumeNotNull(profile);

WebDriver firefox = new FirefoxDriver(profile);
WebDriver firefox = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
firefox.quit();
}

Expand Down Expand Up @@ -371,7 +371,7 @@ public void canBlockInvalidSslCertificates() {

FirefoxDriver secondDriver = null;
try {
secondDriver = new FirefoxDriver(profile);
secondDriver = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
Capabilities caps = secondDriver.getCapabilities();
assertFalse(caps.is(ACCEPT_SSL_CERTS));
} catch (Exception e) {
Expand All @@ -390,7 +390,7 @@ public void shouldAllowUserToSuccessfullyOverrideTheHomePage() {
profile.setPreference("browser.startup.page", "1");
profile.setPreference("browser.startup.homepage", pages.javascriptPage);

final WebDriver driver2 = new FirefoxDriver(profile);
final WebDriver driver2 = new FirefoxDriver(new FirefoxOptions().setProfile(profile));

try {
new WebDriverWait(driver2, 30).until(urlToBe(pages.javascriptPage));
Expand Down Expand Up @@ -525,8 +525,8 @@ public void shouldBeAbleToUseTheSameProfileMoreThanOnce() {
WebDriver two = null;

try {
one = new FirefoxDriver(profile);
two = new FirefoxDriver(profile);
one = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
two = new FirefoxDriver(new FirefoxOptions().setProfile(profile));

// If we get this far, then both firefoxes have started. If this test
// two browsers will start, but the second won't have a valid port and an
Expand All @@ -540,8 +540,8 @@ public void shouldBeAbleToUseTheSameProfileMoreThanOnce() {
// See http://code.google.com/p/selenium/issues/detail?id=1774
@Test
public void canStartFirefoxDriverWithSubclassOfFirefoxProfile() {
new FirefoxDriver(new CustomFirefoxProfile()).quit();
new FirefoxDriver(new FirefoxProfile() {}).quit();
new FirefoxDriver(new FirefoxOptions().setProfile(new CustomFirefoxProfile())).quit();
new FirefoxDriver(new FirefoxOptions().setProfile(new FirefoxProfile() {})).quit();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void canStartDriverWithSpecifiedProfile() {
profile.setPreference("browser.startup.page", 1);
profile.setPreference("browser.startup.homepage", pages.xhtmlTestPage);

localDriver = new FirefoxDriver(profile);
localDriver = new FirefoxDriver(new FirefoxOptions().setProfile(profile));
wait.until($ -> "XHTML Test Page".equals(localDriver.getTitle()));

verifyItIsMarionette(localDriver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
import static org.openqa.selenium.testing.DevMode.isInDevMode;

import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;

import org.openqa.selenium.BuckBuild;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.testing.DevMode;
Expand All @@ -45,20 +45,15 @@ public class SynthesizedFirefoxDriver extends FirefoxDriver {
private static File cachedExt = null;

public SynthesizedFirefoxDriver() {
this(new DesiredCapabilities(), new DesiredCapabilities());
}

public SynthesizedFirefoxDriver(FirefoxProfile profile) throws IOException {
this(new DesiredCapabilities(ImmutableMap.of(PROFILE, profile)), new DesiredCapabilities());
this(new FirefoxOptions());
}

public SynthesizedFirefoxDriver(Capabilities desiredCapabilities) {
this(desiredCapabilities, null);
super(tweakCapabilities(desiredCapabilities));
}

public SynthesizedFirefoxDriver(Capabilities desiredCapabilities,
Capabilities requiredCapabilities) {
super(tweakCapabilities(desiredCapabilities), requiredCapabilities);
public SynthesizedFirefoxDriver(FirefoxOptions options) {
super(tweakCapabilities(options.toCapabilities()));
}

private static Capabilities tweakCapabilities(Capabilities desiredCaps) {
Expand Down

0 comments on commit 3528c0c

Please sign in to comment.