Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Wait for timeout for PageObjects using the webdriver.timeouts.implici…

…tlywait system property (THUCYDIDES-225)

Honor the webdriver.timeouts.implicitlywait system property when configuring the timeout value of a PageObject.
  • Loading branch information...
commit 6ccdd79fa3178c74b58a09d22d2246658ec03dab 1 parent 545e4b1
@wakaleo wakaleo authored
View
15 thucydides-core/src/main/java/net/thucydides/core/pages/PageObject.java
@@ -15,6 +15,7 @@
import net.thucydides.core.scheduling.ThucydidesFluentWait;
import net.thucydides.core.steps.StepDelayer;
import net.thucydides.core.steps.StepEventBus;
+import net.thucydides.core.util.EnvironmentVariables;
import net.thucydides.core.webdriver.DefaultPageObjectInitialiser;
import net.thucydides.core.webdriver.WebDriverFacade;
import net.thucydides.core.webdriver.javascript.JavascriptExecutorFacade;
@@ -66,7 +67,7 @@
private static final Logger LOGGER = LoggerFactory.getLogger(PageObject.class);
- private static final long WAIT_FOR_TIMEOUT = 30000;
+ private static final int WAIT_FOR_TIMEOUT = 30000;
private WebDriver driver;
@@ -83,7 +84,9 @@
private final Sleeper sleeper;
private final Clock webdriverClock;
private JavascriptExecutorFacade javascriptExecutorFacade;
-
+
+ private EnvironmentVariables environmentVariables;
+
private enum OpenMode {
CHECK_URL_PATTERNS,
IGNORE_URL_PATTERNS
@@ -92,6 +95,7 @@
protected PageObject() {
this.webdriverClock = new SystemClock();
this.clock = Injectors.getInjector().getInstance(net.thucydides.core.pages.SystemClock.class);
+ this.environmentVariables = Injectors.getInjector().getInstance(EnvironmentVariables.class);
this.sleeper = Sleeper.SYSTEM_SLEEPER;
setupPageUrls();
}
@@ -118,7 +122,12 @@ protected void setDriver(WebDriver driver, int timeout) {
}
protected void setDriver(WebDriver driver) {
- setDriver(driver, (int) WAIT_FOR_TIMEOUT);
+ setDriver(driver, waitForTimeout());
+ }
+
+ protected int waitForTimeout() {
+ return environmentVariables.getPropertyAsInteger(ThucydidesSystemProperty.TIMEOUTS_IMPLICIT_WAIT, WAIT_FOR_TIMEOUT);
+
}
public void setPages(Pages pages) {
Please sign in to comment.
Something went wrong with that request. Please try again.