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

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

源代码1 项目: selenium   文件: Annotations.java
/**
 * {@inheritDoc}
 *
 * Looks for one of {@link org.openqa.selenium.support.FindBy},
 * {@link org.openqa.selenium.support.FindBys} or
 * {@link org.openqa.selenium.support.FindAll} field annotations. In case
 * no annotations provided for field, uses field name as 'id' or 'name'.
 * @throws IllegalArgumentException when more than one annotation on a field provided
 */
@Override
public By buildBy() {
  assertValidAnnotations();

  By ans = null;

  for (Annotation annotation : field.getDeclaredAnnotations()) {
    AbstractFindByBuilder builder = null;
    if (annotation.annotationType().isAnnotationPresent(PageFactoryFinder.class)) {
      try {
        builder = annotation.annotationType()
            .getAnnotation(PageFactoryFinder.class).value()
            .getDeclaredConstructor().newInstance();
      } catch (ReflectiveOperationException e) {
        // Fall through.
      }
    }
    if (builder != null) {
      ans = builder.buildIt(annotation, field);
      break;
    }
  }

  if (ans == null) {
    ans = buildByFromDefault();
  }

  if (ans == null) {
    throw new IllegalArgumentException("Cannot determine how to locate element " + field);
  }

  return ans;
}
 
 类所在包
 类方法
 同包方法