Skip to content

Commit

Permalink
On behalf of Nikhil Bafna: Fixing AjaxElementLocator to work with
Browse files Browse the repository at this point in the history
SearchContext instead of WebDriver, that allows locating elements inside
other elements. Fixes issue 5283
  • Loading branch information
barancev committed Mar 7, 2013
1 parent 6251aec commit 27a4731
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.openqa.selenium.support.pagefactory;

import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Clock;
import org.openqa.selenium.support.ui.SlowLoadableComponent;
Expand All @@ -44,16 +44,16 @@ public class AjaxElementLocator extends DefaultElementLocator {
/**
* Main constructor.
*
* @param driver The WebDriver to use when locating elements
* @param searchContext The context to use when finding the element
* @param field The field representing this element
* @param timeOutInSeconds How long to wait for the element to appear. Measured in seconds.
*/
public AjaxElementLocator(WebDriver driver, Field field, int timeOutInSeconds) {
this(new SystemClock(), driver, field, timeOutInSeconds);
public AjaxElementLocator(SearchContext searchContext, Field field, int timeOutInSeconds) {
this(new SystemClock(), searchContext, field, timeOutInSeconds);
}

public AjaxElementLocator(Clock clock, WebDriver driver, Field field, int timeOutInSeconds) {
super(driver, field);
public AjaxElementLocator(Clock clock, SearchContext searchContext, Field field, int timeOutInSeconds) {
super(searchContext, field);
this.timeOutInSeconds = timeOutInSeconds;
this.clock = clock;
}
Expand Down Expand Up @@ -102,7 +102,7 @@ protected long sleepFor() {

/**
* By default, elements are considered "found" if they are in the DOM. Override this method in
* order to change whether or not you consider the elemet loaded. For example, perhaps you need
* order to change whether or not you consider the element loaded. For example, perhaps you need
* the element to be displayed:
*
* <pre class="code>
Expand Down

0 comments on commit 27a4731

Please sign in to comment.