本文整理汇总了Java中org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory类的典型用法代码示例。如果您正苦于以下问题:Java DefaultElementLocatorFactory类的具体用法?Java DefaultElementLocatorFactory怎么用?Java DefaultElementLocatorFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultElementLocatorFactory类属于org.openqa.selenium.support.pagefactory包,在下文中一共展示了DefaultElementLocatorFactory类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inject
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
/**
* This method creates the object of type clazz within context defined by the top web element and the
* frame path provided as the parameter.
*
* @param clazz PageObject class.
* @param framePath instance of FramePath.
* @param <T> type of PageObject class that will be returned.
* @return instance of Injector.
*/
public <T> T inject(Class<T> clazz, FramePath framePath) {
final ElementLocatorFactory elementLocatorFactory = new DefaultElementLocatorFactory(webDriver);
stack.push(new PageObjectContext(elementLocatorFactory, framePath));
try {
return injector.getInstance(clazz);
} finally {
stack.pop();
}
}
示例2: HighCharts
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
public HighCharts(WebDriver driver, WebElement chart) {
PageFactory.initElements(new DefaultElementLocatorFactory(chart), this);
this.driver = driver;
this.chart = chart;
int waitTimeoutInSeconds = 15;
wait = new WebDriverWait(driver, waitTimeoutInSeconds, 100);
performAction = new Actions(driver);
}
示例3: initDecorator
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
private static FieldDecorator initDecorator(SearchContext searchContext, Field field) {
FieldDecorator decorator;
AjaxElement ajaxElementAnnotation = field.getAnnotation(AjaxElement.class);
if (ajaxElementAnnotation != null) {
int timeout = ajaxElementAnnotation.timeOutInSeconds();
decorator = new WiseDecorator(new AjaxElementLocatorFactory(searchContext, timeout));
} else {
decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext));
}
return decorator;
}
示例4: Form
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
public Form(SearchContext context) {
PageFactory.initElements(new DefaultElementLocatorFactory(context), this);
}
示例5: Attribute
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
public Attribute(SearchContext context) {
PageFactory.initElements(new DefaultElementLocatorFactory(context), this);
}
示例6: SelenideAppiumFieldDecorator
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
public SelenideAppiumFieldDecorator(SearchContext context) {
super(context);
this.searchContext = context;
this.factory = new DefaultElementLocatorFactory(searchContext);
}
示例7: getDefaultPageObjectContext
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
private PageObjectContext getDefaultPageObjectContext(WebDriver webDriver) {
ElementLocatorFactory elementLocatorFactory = new DefaultElementLocatorFactory(webDriver);
FramePath framePath = new FramePath();
return new PageObjectContext(elementLocatorFactory, framePath);
}
示例8: HighCharts
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
public HighCharts(WebDriver driver, WebElement chart) {
PageFactory.initElements(new DefaultElementLocatorFactory(chart), this);
this.driver = driver;
this.chart = chart;
}
示例9: isReloaded
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
/**
* Recreate the page after a reload, this is important if the weblements are
* cached.
*/
public final void isReloaded() {
PageFactory.initElements(new ElementDecorator(webDriver,
new DefaultElementLocatorFactory(webDriver), pageName, ""),
this);
}
示例10: findElements
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
/**
* Finds all elements within the search context using the given mechanism. <br/>
* An empty list will be returned if the elements couldn't be found. <br/>
*
* @param clazz The class of the elements.
* @param by The locating mechanism to use.
* @param searchContext The search context.
* @return The list of elements.
* @since 0.3.0
*/
public static <E> List<E> findElements(Class<E> clazz, By by, SearchContext searchContext) {
List<WebElement> webElements = searchContext.findElements(by);
if (webElements.isEmpty()) return Lists.newArrayList();
WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(searchContext));
return decorator.decorate(clazz, webElements);
}
示例11: decorateElement
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; //导入依赖的package包/类
/**
* Decorates a webElement.
*
* @param clazz The class of the decorated element. Must be either WebElement or a type
* annotated with Component or Frame.
* @param webElement The webElement that will be decorated.
* @return The decorated element or null if the type isn't supported.
* @since 0.3.0
*/
public static <E> E decorateElement(Class<E> clazz, WebElement webElement) {
WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(webElement));
return decorator.decorate(clazz, webElement);
}