Class Annotations

java.lang.Object
org.openqa.selenium.support.pagefactory.AbstractAnnotations
org.openqa.selenium.support.pagefactory.Annotations

public class Annotations extends AbstractAnnotations
  • Constructor Details

    • Annotations

      public Annotations(Field field)
      Parameters:
      field - expected to be an element in a Page Object
  • Method Details

    • isLookupCached

      public boolean isLookupCached()
      Defines whether given element should be returned from cache on further calls.
      Specified by:
      isLookupCached in class AbstractAnnotations
      Returns:
      true if @CacheLookup annotation exists on a field
    • buildBy

      public By buildBy()
      Defines how to transform given object (field, class, etc.) into By class used by webdriver to locate elements.

      Looks for one of FindBy, FindBys or FindAll field annotations. In case no annotations provided for field, uses field name as 'id' or 'name'.

      Specified by:
      buildBy in class AbstractAnnotations
      Returns:
      By object
      Throws:
      IllegalArgumentException - when more than one annotation on a field provided
    • getField

      protected Field getField()
    • buildByFromDefault

      protected By buildByFromDefault()
    • assertValidAnnotations

      protected void assertValidAnnotations()