类org.openqa.selenium.support.FindAll源码实例Demo

下面列出了怎么用org.openqa.selenium.support.FindAll的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: java-client   文件: DefaultElementByBuilder.java
@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;
}
 
源代码2 项目: selenium   文件: Annotations.java
protected 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");
  }
}
 
源代码3 项目: selenium   文件: DefaultFieldDecorator.java
protected boolean isDecoratableList(Field field) {
  if (!List.class.isAssignableFrom(field.getType())) {
    return false;
  }

  // Type erasure in Java isn't complete. Attempt to discover the generic
  // type of the list.
  Type genericType = field.getGenericType();
  if (!(genericType instanceof ParameterizedType)) {
    return false;
  }

  Type listType = ((ParameterizedType) genericType).getActualTypeArguments()[0];

  if (!WebElement.class.equals(listType)) {
    return false;
  }

  return field.getAnnotation(FindBy.class) != null ||
         field.getAnnotation(FindBys.class) != null ||
         field.getAnnotation(FindAll.class) != null;
}
 
源代码4 项目: java-client   文件: DefaultElementByBuilder.java
@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);
}
 
 类所在包
 同包方法