Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Commit

Permalink
#8 upgrading to selenium 3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
liptga committed Apr 27, 2017
1 parent db0aa49 commit 5ee90a1
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.openqa.selenium.firefox.FirefoxProfile;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;

Expand Down Expand Up @@ -61,7 +60,7 @@ public void adjustFirefoxProfile(FirefoxProfile firefoxProfile) {
"If it does not help, your maven module is not correctly configured. " +
"For configuration details please read the JavaDOC of " + this.getClass().getName() + "!");
}
} catch (IOException | URISyntaxException e) {
} catch (URISyntaxException e) {
throw new RuntimeException("Cannot install adblocker extension!", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void adjustFirefoxBinary(FirefoxBinary firefoxBinary) {
public void adjustFirefoxProfile(FirefoxProfile firefoxProfile) {
firefoxProfile.setPreference("geo.prompt.testing", true);
firefoxProfile.setPreference("geo.prompt.testing.allow", true);
firefoxProfile.setEnableNativeEvents(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package at.willhaben.willtest.config;

import com.google.common.base.Function;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver.Timeouts;
import org.openqa.selenium.support.ui.Wait;
Expand All @@ -10,6 +9,7 @@
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

/**
* Adjusts timeouts available by using <code>webDriver.manage().timeouts()</code>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import at.willhaben.willtest.config.WebDriverConfigurationParticipant;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.remote.DesiredCapabilities;

Expand All @@ -16,7 +17,10 @@ public class LocalFirefoxProvider extends AbstractFirefoxProvider<LocalFirefoxPr
protected FirefoxDriver constructWebDriver(DesiredCapabilities desiredCapabilities) {
FirefoxBinary firefoxBinary = getFirefoxConfiguration().getFirefoxBinary();
FirefoxProfile profile = getFirefoxConfiguration().getFirefoxProfile();
return new FirefoxDriver(firefoxBinary, profile);
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setBinary(firefoxBinary);
firefoxOptions.setProfile(profile);
return new FirefoxDriver(firefoxOptions);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
import org.openqa.selenium.firefox.FirefoxProfile;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeThat;

public class ChangeSettings {
private static final String GEO_LOCATION_IN_THE_MIDDLE_OF_SANKT_POELTEN =
Expand All @@ -26,7 +24,7 @@ public static void beforeClass() {
}

@Rule
public SeleniumRule seleniumRule = new SeleniumRule()
public final SeleniumRule seleniumRule = new SeleniumRule()
//with withDefaultFirefoxSettings settings is getting your location is granted.
//See at.willhaben.willtest.config.DefaultFirefoxConfigurationParticipant
.withDefaultFirefoxSettings()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package at.willhaben.willtest.examples;

import at.willhaben.willtest.misc.rule.SeleniumProviderFactory;
import at.willhaben.willtest.misc.rule.SeleniumProviderFactory.ParameterObject;
import at.willhaben.willtest.misc.rule.SeleniumRule;
import org.junit.AfterClass;
import org.junit.BeforeClass;
Expand All @@ -13,7 +14,7 @@
import static org.junit.Assert.assertThat;

public class DummyTest {
private static Pattern THIS_WILL_BE_INJECTED_INTO_DUMMY_SELENIUM_PROVIDER = Pattern.compile("fooooo");
private static final Pattern THIS_WILL_BE_INJECTED_INTO_DUMMY_SELENIUM_PROVIDER = Pattern.compile("fooooo");
private static String originalProvider;

@BeforeClass
Expand All @@ -31,8 +32,8 @@ public static void afterClass() {
}

@Rule
public SeleniumRule seleniumRule = new SeleniumRule(
new SeleniumProviderFactory.ParameterObject(Pattern.class,THIS_WILL_BE_INJECTED_INTO_DUMMY_SELENIUM_PROVIDER))
public final SeleniumRule seleniumRule = new SeleniumRule(
new ParameterObject(Pattern.class,THIS_WILL_BE_INJECTED_INTO_DUMMY_SELENIUM_PROVIDER))
.withoutImplicitWait()
.withoutScriptTimeout();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
import org.openqa.selenium.WebElement;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeThat;

public class FirstExample {
private static final String REPO_HEADER_LOCATOR = "div.repohead-details-container h1";
Expand All @@ -23,7 +21,7 @@ public static void beforeClass() {
}

@Rule
public SeleniumRule seleniumRule = new SeleniumRule();
public final SeleniumRule seleniumRule = new SeleniumRule();

@Test
public void openPage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class RetryExample {
// re-run in case of test failure
.secondOuterRule(
new Retry(
new ExceptionMatcher<WebDriverException>(
new ExceptionMatcher<>(
WebDriverException.class,
containsString("Unable to bind to locking port")),
5));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class SeleniumRule<P extends SeleniumProvider<P, D> & TestRule, D extends
* Constructs the rule without parameterObjects
*/
public SeleniumRule() {
this(null);
this((ParameterObject[])null);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.selenium>2.53.1</version.selenium>
<version.selenium>3.4.0</version.selenium>
<version.log4j>1.2.16</version.log4j>
</properties>

Expand Down

0 comments on commit 5ee90a1

Please sign in to comment.