本文整理了Java中org.openqa.selenium.support.pagefactory.Annotations.buildBy()
方法的一些代码示例,展示了Annotations.buildBy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotations.buildBy()
方法的具体详情如下:
包路径:org.openqa.selenium.support.pagefactory.Annotations
类名称:Annotations
方法名:buildBy
暂无
代码示例来源:origin: selenide/selenide
@Override
public Object decorate(ClassLoader loader, Field field) {
By selector = new Annotations(field).buildBy();
if (WebElement.class.isAssignableFrom(field.getType())) {
return ElementFinder.wrap(driver, searchContext, selector, 0);
}
if (ElementsCollection.class.isAssignableFrom(field.getType())) {
return new ElementsCollection(new BySelectorCollection(driver, searchContext, selector));
}
else if (ElementsContainer.class.isAssignableFrom(field.getType())) {
return createElementsContainer(selector, field);
}
else if (isDecoratableList(field, ElementsContainer.class)) {
return createElementsContainerList(field);
}
else if (isDecoratableList(field, SelenideElement.class)) {
return SelenideElementListProxy.wrap(driver, factory.createLocator(field));
}
return super.decorate(loader, field);
}
代码示例来源:origin: org.jsystemtest/webdriver-so
@Override
public By buildBy() {
ElementInFrameList framelist;
if ((framelist = field.getAnnotation(ElementInFrameList.class)) != null) {
return new ByFramePath(super.buildBy(), framelist.value());
}
else {
return super.buildBy();
}
}
代码示例来源:origin: com.arcbees/testutils
private void processFindBy(Field field, Annotations annotations) {
FindByDebugId findByDebugId = field.getAnnotation(FindByDebugId.class);
if (findByDebugId != null) {
String id = findByDebugId.value();
by = new ByDebugId(id);
} else {
by = annotations.buildBy();
}
}
}
代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-support
/**
* Creates a new element locator.
*
* @param driver The driver to use when finding the element
* @param field The field on the Page Object that will hold the located value
*/
public DefaultElementLocator(WebDriver driver, Field field) {
this.driver = driver;
Annotations annotations = new Annotations(field);
cacheElement = annotations.isLookupCached();
by = annotations.buildBy();
}
代码示例来源:origin: org.seleniumhq.webdriver/webdriver-support
/**
* Creates a new element locator.
*
* @param driver The driver to use when finding the element
* @param field The field on the Page Object that will hold the located value
*/
public DefaultElementLocator(WebDriver driver, Field field) {
this.driver = driver;
Annotations annotations = new Annotations(field);
cacheElement = annotations.isLookupCached();
by = annotations.buildBy();
}
代码示例来源:origin: net.serenity-bdd/serenity-core
public org.openqa.selenium.By buildBy() {
assertValidAnnotations();
org.openqa.selenium.By ans = null;
//default implementation in case if org.openqa.selenium.support.FindBy was used
org.openqa.selenium.support.FindBy findBy = field.getAnnotation(org.openqa.selenium.support.FindBy.class);
if (ans == null && findBy != null) {
ans = super.buildBy();
}
//my additions to FindBy
FindBy myFindBy = field.getAnnotation(FindBy.class);
if (ans == null && myFindBy != null) {
ans = buildByFromFindBy(myFindBy);
}
if (ans == null) {
ans = buildByFromDefault();
}
if (ans == null) {
throw new IllegalArgumentException("Cannot determine how to locate element " + field);
}
return ans;
}
代码示例来源:origin: qaprosoft/carina
@Override
public By buildBy() {
By by = super.buildBy();
String param = by.toString();
// replace by using localization pattern
Matcher matcher = L10N_PATTERN.matcher(param);
while (matcher.find()) {
int start = param.indexOf(SpecialKeywords.L10N + ":") + 5;
int end = param.indexOf("}");
String key = param.substring(start, end);
param = StringUtils.replace(param, matcher.group(), L10N.getText(key));
}
if (getField().isAnnotationPresent(Predicate.class)) {
// TODO: analyze howto determine iOS or Android predicate
param = StringUtils.remove(param, "By.xpath: ");
by = MobileBy.iOSNsPredicateString(param);
// by = MobileBy.AndroidUIAutomator(param);
} else if (getField().isAnnotationPresent(ClassChain.class)) {
param = StringUtils.remove(param, "By.xpath: ");
by = MobileBy.iOSClassChain(param);
} else if (getField().isAnnotationPresent(AccessibilityId.class)) {
param = StringUtils.remove(param, "By.name: ");
by = MobileBy.AccessibilityId(param);
} else {
by = createBy(param);
}
return by;
}
代码示例来源:origin: net.serenity-bdd/serenity-core
by = super.buildBy();
代码示例来源:origin: yandex-qatools/htmlelements
@Override
public By buildBy() {
if (isHtmlElement(getField()) || isTypifiedElement(getField())) {
return buildByFromHtmlElementAnnotations();
}
if (isHtmlElementList(getField()) || isTypifiedElementList(getField())) {
return buildByFromHtmlElementListAnnotations();
}
return super.buildBy();
}
代码示例来源:origin: ru.yandex.qatools.htmlelements/htmlelements-java
@Override
public By buildBy() {
if (isHtmlElement(getField()) || isTypifiedElement(getField())) {
return buildByFromHtmlElementAnnotations();
}
if (isHtmlElementList(getField()) || isTypifiedElementList(getField())) {
return buildByFromHtmlElementListAnnotations();
}
return super.buildBy();
}
代码示例来源:origin: ru.sbtqa.htmlelements/htmlelements-java
@Override
public By buildBy() {
if (isHtmlElement(getField()) || isTypifiedElement(getField())) {
return buildByFromHtmlElementAnnotations();
}
if (isHtmlElementList(getField()) || isTypifiedElementList(getField())) {
return buildByFromHtmlElementListAnnotations();
}
return super.buildBy();
}
内容来源于网络,如有侵权,请联系作者删除!