Package com.codeborne.selenide.impl
Class SelenidePageFactory
java.lang.Object
com.codeborne.selenide.impl.SelenidePageFactory
- All Implemented Interfaces:
PageObjectFactory
- Direct Known Subclasses:
SelenideAppiumPageFactory
@ParametersAreNonnullByDefault
public class SelenidePageFactory
extends Object
implements PageObjectFactory
Factory class to make using Page Objects simpler and easier.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected BaseElementsCollection<? extends SelenideElement,
? extends BaseElementsCollection<?, ?>> createCollection
(CollectionSource collection, Class<?> klass) protected BaseElementsCollection<? extends SelenideElement,
? extends BaseElementsCollection<?, ?>> createElementsCollection
(Driver driver, WebElementSource searchContext, org.openqa.selenium.By selector, Field field, String alias) createElementsContainer
(Driver driver, WebElementSource searchContext, Field field, org.openqa.selenium.By selector) createElementsContainerList
(Driver driver, WebElementSource searchContext, Field field, Type[] genericTypes, org.openqa.selenium.By selector) protected Object
createFieldValue
(Driver driver, WebElementSource searchContext, Object page, Type[] genericTypes, Field field) decorate
(ClassLoader loader, Driver driver, WebElementSource searchContext, Field field, org.openqa.selenium.By selector, Type[] genericTypes) protected SelenideElement
decorateWebElement
(Driver driver, WebElementSource searchContext, org.openqa.selenium.By selector, Field field, String alias) protected org.openqa.selenium.support.pagefactory.FieldDecorator
defaultFieldDecorator
(Driver driver, WebElementSource searchContext) protected org.openqa.selenium.By
findSelector
(Driver driver, Field field) protected Object
getFieldValue
(Object page, Field field) protected Class<?>
getListGenericType
(Field field, Type[] genericTypes) protected org.openqa.selenium.SearchContext
getSearchContext
(Driver driver, WebElementSource searchContext) protected int
void
initElements
(Driver driver, WebElementSource searchContext, Object page, Type[] genericTypes) Similar to the other "initElements" methods, but takes anFieldDecorator
which is used for decorating each of the fields.initElementsContainer
(Driver driver, Field field, WebElementSource self, Class<?> type, Type[] genericTypes) protected void
initField
(Driver driver, WebElementSource searchContext, Object page, Type[] genericTypes, Field field) protected void
initFields
(Driver driver, WebElementSource searchContext, Object page, Class<?> proxyIn, Type[] genericTypes) protected boolean
isDecoratableList
(Field field, org.openqa.selenium.By selector, Type[] genericTypes, Class<?> type) <PageObjectClass>
PageObjectClass<PageObjectClass,
T extends PageObjectClass>
PageObjectClassprotected void
setFieldValue
(Object page, Field field, Object value) protected boolean
shouldCache
(Field field)
-
Constructor Details
-
SelenidePageFactory
public SelenidePageFactory()
-
-
Method Details
-
page
@CheckReturnValue @Nonnull public <PageObjectClass> PageObjectClass page(Driver driver, Class<PageObjectClass> pageObjectClass) - Specified by:
page
in interfacePageObjectFactory
-
page
@CheckReturnValue @Nonnull public <PageObjectClass,T extends PageObjectClass> PageObjectClass page(Driver driver, T pageObject) - Specified by:
page
in interfacePageObjectFactory
-
initElements
public void initElements(Driver driver, @Nullable WebElementSource searchContext, Object page, Type[] genericTypes) Similar to the other "initElements" methods, but takes anFieldDecorator
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
-
findSelector
- 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
-
setFieldValue
-
getFieldValue
-
createElementsContainer
@CheckReturnValue @Nonnull public Container createElementsContainer(Driver driver, @Nullable WebElementSource searchContext, Field field, org.openqa.selenium.By selector) - Specified by:
createElementsContainer
in interfacePageObjectFactory
-
initElementsContainer
@CheckReturnValue @Nonnull public Container initElementsContainer(Driver driver, Field field, WebElementSource self, Class<?> type, Type[] genericTypes) throws ReflectiveOperationException - Specified by:
initElementsContainer
in interfacePageObjectFactory
- Throws:
ReflectiveOperationException
-
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 BaseElementsCollection<? extends SelenideElement,? extends BaseElementsCollection<?, createElementsCollection?>> (Driver driver, @Nullable WebElementSource searchContext, org.openqa.selenium.By selector, Field field, @Nullable String alias) -
createCollection
@Nonnull protected BaseElementsCollection<? extends SelenideElement,? extends BaseElementsCollection<?, createCollection?>> (CollectionSource collection, Class<?> klass) -
defaultFieldDecorator
@CheckReturnValue @Nonnull protected org.openqa.selenium.support.pagefactory.FieldDecorator defaultFieldDecorator(Driver driver, @Nullable WebElementSource searchContext) -
getSearchContext
@Nonnull @CheckReturnValue protected org.openqa.selenium.SearchContext getSearchContext(Driver driver, @Nullable WebElementSource searchContext) -
createElementsContainerList
-
isDecoratableList
-
getListGenericType
-
indexOf
-