Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix element timeout changing page object timeout issue #468

Merged
merged 1 commit into from
Sep 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class AppiumElementLocator implements CacheableLocator {
final boolean shouldCache;
final By by;
final TimeOutDuration timeOutDuration;
private final TimeOutDuration originalTimeOutDuration;
final WebDriver originalWebDriver;
private final SearchContext searchContext;
private final WaitingFunction waitingFunction;
Expand All @@ -56,16 +57,18 @@ class AppiumElementLocator implements CacheableLocator {
* @param by a By locator strategy
* @param shouldCache is the flag that signalizes that elements which
* are found once should be cached
* @param duration is a POJO which contains timeout parameters
* @param duration is a POJO which contains timeout parameters for the element to be searched
* @param originalDuration is a POJO which contains timeout parameters from page object which contains the element
* @param originalWebDriver is an instance of WebDriver that is going to be
* used by a proxied element
*/

public AppiumElementLocator(SearchContext searchContext, By by, boolean shouldCache,
TimeOutDuration duration, WebDriver originalWebDriver) {
TimeOutDuration duration, TimeOutDuration originalDuration, WebDriver originalWebDriver) {
this.searchContext = searchContext;
this.shouldCache = shouldCache;
this.timeOutDuration = duration;
this.originalTimeOutDuration = originalDuration;
this.by = by;
this.originalWebDriver = originalWebDriver;
waitingFunction = new WaitingFunction(this.searchContext);
Expand All @@ -89,7 +92,7 @@ private List<WebElement> waitFor() {
} catch (TimeoutException e) {
return new ArrayList<>();
} finally {
changeImplicitlyWaitTimeOut(timeOutDuration.getTime(), timeOutDuration.getTimeUnit());
changeImplicitlyWaitTimeOut(originalTimeOutDuration.getTime(), originalTimeOutDuration.getTimeUnit());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public CacheableLocator createLocator(Field field) {
By by = builder.buildBy();
if (by != null) {
return new AppiumElementLocator(searchContext, by, builder.isLookupCached(),
customDuration, originalWebDriver);
customDuration, timeOutDuration, originalWebDriver);
}
return null;
}
Expand Down