类org.openqa.selenium.support.pagefactory.AbstractAnnotations源码实例Demo

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

源代码1 项目: bobcat   文件: FieldAnnotationsProvider.java
/**
 * Provides an {@link AbstractAnnotations} implementation based on provided field's annotations.
 *
 * @param field    which annotations are checked
 * @param injector to provide Bobcat-augmented annotations
 * @return <ul>
 * <li>{@link Annotations} for fields decorated with {@link org.openqa.selenium.support.FindBy}, {@link org.openqa.selenium.support.FindAll} or {@link org.openqa.selenium.support.FindBys}</li>
 * <li>{@link BobcatAnnotations} for fields decorated with {@link com.cognifide.qa.bb.qualifier.FindPageObject}</li>
 * </ul>
 * @throws IllegalArgumentException when the field is not decorated with any of the above annotations
 */
public static AbstractAnnotations create(Field field, Injector injector) {
  if (AnnotationsHelper.isFindByAnnotationPresent(field)) {
    return new Annotations(field);
  }
  if (AnnotationsHelper.isFindPageObjectAnnotationPresent(field)) {
    return new BobcatAnnotations(field, injector);
  }
  throw new IllegalArgumentException(
      "Field is not marked by any supported annotation: " + field.toGenericString());
}
 
 类所在包
 类方法
 同包方法