下面列出了怎么用org.openqa.selenium.support.pagefactory.AbstractAnnotations的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* 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());
}