@Component(value="tapirSeleniumElementFactory") public class SeleniumElementFactory extends Object
SingleWebElementBased
and MultiWebElementBased
and injects the web element(s) into the created bean.SingleWebElementBased
,
MultiWebElementBased
Constructor and Description |
---|
SeleniumElementFactory() |
Modifier and Type | Method and Description |
---|---|
<T extends MultiWebElementBased> |
autowireSeleniumElement(T multiWebElementBased,
List<org.openqa.selenium.WebElement> webElements)
Autowires the given multiWebElementBased and sets the given web elements by calling
MultiWebElementBased.setWebElements(List) . |
<T extends SingleWebElementBased> |
autowireSeleniumElement(T singleWebElementBased,
org.openqa.selenium.WebElement webElement)
Autowires the given singleWebelementBased and sets the given web element by calling
SingleWebElementBased.setWebElement(WebElement) . |
<T> T |
getSeleniumElement(List<org.openqa.selenium.WebElement> webElements,
Class<T> type,
Object... args)
Returns a Selenium element for the given web elements.
|
<T> T |
getSeleniumElement(List<org.openqa.selenium.WebElement> webElements,
com.google.common.reflect.TypeToken<T> typeToken,
Object... args) |
<T> T |
getSeleniumElement(org.openqa.selenium.WebElement webElement,
Class<T> type,
Object... args)
Returns a Selenium element for the given web element.
|
<T> T |
getSeleniumElement(WebElementProvider webElementProvider,
Class<T> type,
Object... args)
Returns a Selenium element for the web element(s) provided by the given webElementProvider.
|
<T> T |
getSeleniumElement(WebElementProvider webElementProvider,
com.google.common.reflect.TypeToken<T> typeToken,
Object... args) |
<T> T |
getSeleniumElement(org.openqa.selenium.WebElement webElement,
com.google.common.reflect.TypeToken<T> typeToken,
Object... args) |
protected void |
injectTypeArgument(Object bean,
com.google.common.reflect.TypeToken<?> typeToken) |
public <T> T getSeleniumElement(WebElementProvider webElementProvider, Class<T> type, Object... args)
BeanFactory.getBean(Class, Object...)
by passing the given type and
args. Depending on the interface which the bean implements, the corresponding WebElementProvider
method is
called in order to determine the web element(s).
The web element(s) is/are set by this method, so clients do not have to care about the initialization.T
- The resulting bean typewebElementProvider
- the web element provider. The type of the bean decides which method of the provider is called.type
- The type of the element which should be builtargs
- The type argumentsIllegalStateException
- thrown if the bean for the given type does not implement SingleWebElementBased
or MultiWebElementBased
.public <T> T getSeleniumElement(WebElementProvider webElementProvider, com.google.common.reflect.TypeToken<T> typeToken, Object... args)
public <T> T getSeleniumElement(org.openqa.selenium.WebElement webElement, Class<T> type, Object... args)
SingleWebElementBased
, otherwise an IllegalStateException
is thrown.T
- The resulting bean typewebElement
- the web elementtype
- The type of the element which should be builtargs
- The type argumentsIllegalStateException
- thrown if the bean for the given type does not implement SingleWebElementBased
public <T> T getSeleniumElement(org.openqa.selenium.WebElement webElement, com.google.common.reflect.TypeToken<T> typeToken, Object... args)
public <T> T getSeleniumElement(List<org.openqa.selenium.WebElement> webElements, Class<T> type, Object... args)
MultiWebElementBased
, otherwise an IllegalStateException
is thrown.T
- The resulting bean typewebElements
- the web elementstype
- The type of the element which should be builtargs
- The type argumentsIllegalStateException
- thrown if the bean for the given type does not implement MultiWebElementBased
public <T> T getSeleniumElement(List<org.openqa.selenium.WebElement> webElements, com.google.common.reflect.TypeToken<T> typeToken, Object... args)
protected void injectTypeArgument(Object bean, com.google.common.reflect.TypeToken<?> typeToken)
public <T extends SingleWebElementBased> T autowireSeleniumElement(T singleWebElementBased, org.openqa.selenium.WebElement webElement)
SingleWebElementBased.setWebElement(WebElement)
.T
- the bean typesingleWebElementBased
- the element to be initializedwebElement
- the web element on which the given SingleWebElementBased
is based on.public <T extends MultiWebElementBased> T autowireSeleniumElement(T multiWebElementBased, List<org.openqa.selenium.WebElement> webElements)
MultiWebElementBased.setWebElements(List)
.T
- the bean typemultiWebElementBased
- the element to be initializedwebElements
- the web elements on which the given MultiWebElementBased
is based on.Copyright © 2018–2019 b+m Informatik AG. All rights reserved.