public class ElementFactory extends Object implements IElementFactory
| Constructor and Description |
|---|
ElementFactory(IConditionalWait conditionalWait,
IElementFinder elementFinder,
ILocalizationManager localizationManager) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
extractXPathFromLocator(org.openqa.selenium.By locator)
Extracts XPath from passed locator.
|
<T extends IElement> |
findChildElement(IElement parentElement,
org.openqa.selenium.By childLoc,
String name,
Class<T> clazz,
ElementState state)
Finds child element by its locator relative to parent element.
|
<T extends IElement> |
findChildElement(IElement parentElement,
org.openqa.selenium.By childLoc,
String name,
IElementSupplier<T> supplier,
ElementState state)
Finds child element by its locator relative to parent element.
|
<T extends IElement> |
findChildElements(IElement parentElement,
org.openqa.selenium.By childLoc,
String name,
Class<T> clazz,
ElementsCount count,
ElementState state)
Finds child elements by their locator relative to parent element.
|
<T extends IElement> |
findChildElements(IElement parentElement,
org.openqa.selenium.By childLoc,
String name,
IElementSupplier<T> supplier,
ElementsCount count,
ElementState state)
Finds child elements by their locator relative to parent element.
|
<T extends IElement> |
findElements(org.openqa.selenium.By locator,
String name,
Class<T> clazz,
ElementsCount count,
ElementState state)
Find list of elements.
|
<T extends IElement> |
findElements(org.openqa.selenium.By locator,
String name,
IElementSupplier<T> supplier,
ElementsCount count,
ElementState state)
Find list of elements.
|
protected org.openqa.selenium.By |
generateAbsoluteChildLocator(org.openqa.selenium.By parentLoc,
org.openqa.selenium.By childLoc)
Generates absolute child locator for target element.
|
protected org.openqa.selenium.By |
generateXpathLocator(org.openqa.selenium.By multipleElementsLocator,
org.openqa.selenium.WebElement webElement,
int elementIndex)
Generates xpath locator for target element.
|
<T extends IElement> |
getCustomElement(Class<T> clazz,
org.openqa.selenium.By locator,
String name,
ElementState state)
Create custom element according to passed parameters.
|
<T extends IElement> |
getCustomElement(IElementSupplier<T> elementSupplier,
org.openqa.selenium.By locator,
String name,
ElementState state)
Create custom element according to passed parameters.
|
protected <T extends IElement> |
getDefaultElementSupplier(Class<T> clazz) |
protected Map<Class<? extends IElement>,Class<? extends IElement>> |
getElementTypesMap()
Gets map between elements interfaces and their implementations.
|
protected boolean |
isLocatorSupportedForXPathExtraction(org.openqa.selenium.By locator)
Defines is the locator can be transformed to xpath or not.
|
protected <T extends IElement> |
resolveElementClass(Class<T> clazz) |
protected void |
waitForElementsCount(org.openqa.selenium.By locator,
ElementsCount count,
ElementState state) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindChildElement, findChildElement, findChildElement, findChildElement, findChildElement, findChildElement, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findChildElements, findElements, findElements, findElements, findElements, findElements, findElements, findElements, findElements, findElements, findElements, findElements, findElements, getCustomElement, getCustomElement@Inject public ElementFactory(IConditionalWait conditionalWait, IElementFinder elementFinder, ILocalizationManager localizationManager)
public <T extends IElement> T getCustomElement(IElementSupplier<T> elementSupplier, org.openqa.selenium.By locator, String name, ElementState state)
IElementFactorygetCustomElement in interface IElementFactoryT - Type of the target element.elementSupplier - Delegate that defines constructor of element.locator - Locator of the target element.name - Name of the target element.state - Visibility state of the target element.public <T extends IElement> T getCustomElement(Class<T> clazz, org.openqa.selenium.By locator, String name, ElementState state)
IElementFactorygetCustomElement in interface IElementFactoryT - Type of the target element.clazz - Class or interface of the element to be obtained.locator - Locator of the target element.name - Name of the target element.state - Visibility state of the target element.public <T extends IElement> T findChildElement(IElement parentElement, org.openqa.selenium.By childLoc, String name, Class<T> clazz, ElementState state)
IElementFactoryfindChildElement in interface IElementFactoryT - Type of the target element.parentElement - Parent element for relative search of child element.childLoc - Locator of child element relative to its parent.name - Child element name.clazz - Class or interface of the element to be obtained.state - Visibility state of target element.public <T extends IElement> T findChildElement(IElement parentElement, org.openqa.selenium.By childLoc, String name, IElementSupplier<T> supplier, ElementState state)
IElementFactoryfindChildElement in interface IElementFactoryT - Type of the target element.parentElement - Parent element for relative search of child element.childLoc - Locator of child element relative to its parent.name - Child element name.supplier - Required element's supplier.state - Visibility state of child element.public <T extends IElement> List<T> findChildElements(IElement parentElement, org.openqa.selenium.By childLoc, String name, Class<T> clazz, ElementsCount count, ElementState state)
IElementFactoryfindChildElements in interface IElementFactoryT - Type of the target elements.parentElement - Parent element for relative search of child elements.childLoc - Locator of child elements relative to its parent.name - Child elements name.clazz - Class or interface of the elements to be obtained.count - Expected number of elements that have to be found (zero, more then zero, any).state - Visibility state of target elements.public <T extends IElement> List<T> findChildElements(IElement parentElement, org.openqa.selenium.By childLoc, String name, IElementSupplier<T> supplier, ElementsCount count, ElementState state)
IElementFactoryfindChildElements in interface IElementFactoryT - Type of the target elements.parentElement - Parent element for relative search of child elements.childLoc - Locator of child elements relative to its parent.name - Child elements name.supplier - Required elements' supplier.state - Visibility state of child elements.public <T extends IElement> List<T> findElements(org.openqa.selenium.By locator, String name, IElementSupplier<T> supplier, ElementsCount count, ElementState state)
IElementFactoryfindElements in interface IElementFactoryT - Type of the target element.locator - Elements selector.name - Child element name.supplier - Required elements' supplier.count - Expected number of elements that have to be found (zero, more then zero, any).state - Visibility state of target elements.protected void waitForElementsCount(org.openqa.selenium.By locator,
ElementsCount count,
ElementState state)
throws TimeoutException
TimeoutExceptionpublic <T extends IElement> List<T> findElements(org.openqa.selenium.By locator, String name, Class<T> clazz, ElementsCount count, ElementState state)
IElementFactoryfindElements in interface IElementFactoryT - Type of the target element.locator - Elements selector.name - Child element name.clazz - Class or interface of the element to be obtained.count - Expected number of elements that have to be found (zero, more then zero, any).state - Visibility state of target elements.protected org.openqa.selenium.By generateXpathLocator(org.openqa.selenium.By multipleElementsLocator,
org.openqa.selenium.WebElement webElement,
int elementIndex)
multipleElementsLocator - locator used to find elements. Currently only By.ByXPath locators are supported.webElement - target element.elementIndex - index of target element.protected String extractXPathFromLocator(org.openqa.selenium.By locator)
locator - locator to get xpath from.protected org.openqa.selenium.By generateAbsoluteChildLocator(org.openqa.selenium.By parentLoc,
org.openqa.selenium.By childLoc)
parentLoc - parent locatorchildLoc - child locator relative to parentprotected boolean isLocatorSupportedForXPathExtraction(org.openqa.selenium.By locator)
locator - locator to transformprotected Map<Class<? extends IElement>,Class<? extends IElement>> getElementTypesMap()
protected <T extends IElement> IElementSupplier<T> getDefaultElementSupplier(Class<T> clazz)
Copyright © 2020. All rights reserved.