use of org.openqa.selenium.support.FindAll in project selenium_java by sergueik.
the class DynamicAnnotations method buildBy.
public By buildBy() {
assertValidAnnotations();
By ans = null;
FindBys findBys = field.getAnnotation(FindBys.class);
if (findBys != null) {
// building a chained locator
ans = buildByFromFindBys(findBys);
}
FindAll findAll = field.getAnnotation(FindAll.class);
if (ans == null && findAll != null) {
// building a find by one of locator
ans = buildBysFromFindByOneOf(findAll);
}
FindBy findBy = field.getAnnotation(FindBy.class);
if (ans == null && findBy != null) {
// building an ordinary locator
ans = buildByFromFindBy(findBy);
}
if (ans == null) {
// without locator annotation will build a locator based on field name
// id or name
ans = buildByFromDefault();
}
if (ans == null) {
throw new IllegalArgumentException("Cannot determine how to locate element " + field);
}
return ans;
}
use of org.openqa.selenium.support.FindAll in project java-client by appium.
the class DefaultElementByBuilder method assertValidAnnotations.
@Override
protected void assertValidAnnotations() {
AnnotatedElement annotatedElement = annotatedElementContainer.getAnnotated();
FindBy findBy = annotatedElement.getAnnotation(FindBy.class);
FindBys findBys = annotatedElement.getAnnotation(FindBys.class);
checkDisallowedAnnotationPairs(findBy, findBys);
FindAll findAll = annotatedElement.getAnnotation(FindAll.class);
checkDisallowedAnnotationPairs(findBy, findAll);
checkDisallowedAnnotationPairs(findBys, findAll);
}
use of org.openqa.selenium.support.FindAll in project java-client by appium.
the class DefaultElementByBuilder method buildDefaultBy.
@Override
protected By buildDefaultBy() {
AnnotatedElement annotatedElement = annotatedElementContainer.getAnnotated();
By defaultBy = null;
FindBy findBy = annotatedElement.getAnnotation(FindBy.class);
if (findBy != null) {
defaultBy = new FindBy.FindByBuilder().buildIt(findBy, (Field) annotatedElement);
}
if (defaultBy == null) {
FindBys findBys = annotatedElement.getAnnotation(FindBys.class);
if (findBys != null) {
defaultBy = new FindBys.FindByBuilder().buildIt(findBys, (Field) annotatedElement);
}
}
if (defaultBy == null) {
FindAll findAll = annotatedElement.getAnnotation(FindAll.class);
if (findAll != null) {
defaultBy = new FindAll.FindByBuilder().buildIt(findAll, (Field) annotatedElement);
}
}
return defaultBy;
}
use of org.openqa.selenium.support.FindAll in project selenium_java by sergueik.
the class DynamicAnnotations method assertValidAnnotations.
public void assertValidAnnotations() {
FindBys findBys = field.getAnnotation(FindBys.class);
FindAll findAll = field.getAnnotation(FindAll.class);
FindBy findBy = field.getAnnotation(FindBy.class);
if (findBys != null && findBy != null) {
throw new IllegalArgumentException("If you use a '@FindBys' annotation, " + "you must not also use a '@FindBy' annotation");
}
if (findAll != null && findBy != null) {
throw new IllegalArgumentException("If you use a '@FindAll' annotation, " + "you must not also use a '@FindBy' annotation");
}
if (findAll != null && findBys != null) {
throw new IllegalArgumentException("If you use a '@FindAll' annotation, " + "you must not also use a '@FindBys' annotation");
}
}
Aggregations