org.openqa.selenium.support.AbstractFindByBuilder Java Examples
The following examples show how to use
org.openqa.selenium.support.AbstractFindByBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Annotations.java From selenium with Apache License 2.0 | 5 votes |
/** * {@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; }