Class SelenidePageFactory

java.lang.Object
com.codeborne.selenide.impl.SelenidePageFactory
All Implemented Interfaces:
PageObjectFactory

@ParametersAreNonnullByDefault public class SelenidePageFactory extends Object implements PageObjectFactory
Factory class to make using Page Objects simpler and easier.
See Also:
  • Constructor Details

    • SelenidePageFactory

      public SelenidePageFactory()
  • Method Details

    • page

      @CheckReturnValue @Nonnull public <PageObjectClass> PageObjectClass page(Driver driver, Class<PageObjectClass> pageObjectClass)
      Specified by:
      page in interface PageObjectFactory
    • page

      @CheckReturnValue @Nonnull public <PageObjectClass, T extends PageObjectClass> PageObjectClass page(Driver driver, T pageObject)
      Specified by:
      page in interface PageObjectFactory
    • initElements

      public void initElements(Driver driver, @Nullable WebElementSource searchContext, Object page, Type[] genericTypes)
      Similar to the other "initElements" methods, but takes an FieldDecorator which is used for decorating each of the fields.
      Parameters:
      page - The object to decorate the fields of
    • initFields

      protected void initFields(Driver driver, @Nullable WebElementSource searchContext, Object page, Class<?> proxyIn, Type[] genericTypes)
    • initField

      protected void initField(Driver driver, @Nullable WebElementSource searchContext, Object page, Type[] genericTypes, Field field)
    • createFieldValue

      @Nullable @CheckReturnValue protected Object createFieldValue(Driver driver, @Nullable WebElementSource searchContext, Object page, Type[] genericTypes, Field field)
    • findSelector

      @Nonnull protected org.openqa.selenium.By findSelector(Driver driver, Field field)
      Parameters:
      driver - Used by subclasses (e.g. in selenide-appium plugin)
      field - expected to be an element in a Page Object
      Returns:
      By instance used by webdriver to locate elements
    • shouldCache

      protected boolean shouldCache(Field field)
    • setFieldValue

      protected void setFieldValue(Object page, Field field, Object value)
    • getFieldValue

      @CheckReturnValue @Nullable protected Object getFieldValue(Object page, Field field)
    • createElementsContainer

      @CheckReturnValue @Nonnull public Container createElementsContainer(Driver driver, @Nullable WebElementSource searchContext, Field field, org.openqa.selenium.By selector)
      Specified by:
      createElementsContainer in interface PageObjectFactory
    • initElementsContainer

      @CheckReturnValue @Nonnull public Container initElementsContainer(Driver driver, Field field, WebElementSource self, Class<?> type, Type[] genericTypes) throws ReflectiveOperationException
      Specified by:
      initElementsContainer in interface PageObjectFactory
      Throws:
      ReflectiveOperationException
    • decorate

      @CheckReturnValue @Nullable public final Object decorate(ClassLoader loader, Driver driver, @Nullable WebElementSource searchContext, Field field, org.openqa.selenium.By selector)
    • decorate

      @CheckReturnValue @Nullable public Object decorate(ClassLoader loader, Driver driver, @Nullable WebElementSource searchContext, Field field, org.openqa.selenium.By selector, Type[] genericTypes)
    • decorateWebElement

      @Nonnull protected SelenideElement decorateWebElement(Driver driver, @Nullable WebElementSource searchContext, org.openqa.selenium.By selector, Field field, @Nullable String alias)
    • createElementsCollection

      @Nonnull protected ElementsCollection createElementsCollection(Driver driver, @Nullable WebElementSource searchContext, org.openqa.selenium.By selector, Field field, @Nullable String alias)
    • defaultFieldDecorator

      @CheckReturnValue @Nonnull protected org.openqa.selenium.support.pagefactory.DefaultFieldDecorator defaultFieldDecorator(Driver driver, @Nullable WebElementSource searchContext)
    • createElementsContainerList

      @CheckReturnValue @Nonnull protected List<Container> createElementsContainerList(Driver driver, @Nullable WebElementSource searchContext, Field field, Type[] genericTypes, org.openqa.selenium.By selector)
    • isDecoratableList

      @CheckReturnValue protected boolean isDecoratableList(Field field, Type[] genericTypes, Class<?> type)
    • getListGenericType

      @CheckReturnValue @Nullable protected Class<?> getListGenericType(Field field, Type[] genericTypes)
    • indexOf

      protected int indexOf(Class<?> klass, Type firstArgument)