public abstract class BaseAugmenter
extends java.lang.Object
RemoteWebDriver
based on the returned
Capabilities
of the driver.
Note: this class is still experimental. Use at your own risk.Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,AugmenterProvider> |
driverAugmentors |
private java.util.Map<java.lang.String,AugmenterProvider> |
elementAugmentors |
Constructor and Description |
---|
BaseAugmenter() |
Modifier and Type | Method and Description |
---|---|
void |
addDriverAugmentation(java.lang.String capabilityName,
AugmenterProvider handlerClass)
Add a mapping between a capability name and the implementation of the interface that name
represents for instances of
WebDriver . |
void |
addElementAugmentation(java.lang.String capabilityName,
AugmenterProvider handlerClass)
Add a mapping between a capability name and the implementation of the interface that name
represents for instances of
WebElement . |
org.openqa.selenium.WebElement |
augment(RemoteWebElement element)
Enhance the interfaces implemented by this instance of WebElement iff that instance is a
RemoteWebElement . |
org.openqa.selenium.WebDriver |
augment(org.openqa.selenium.WebDriver driver)
Enhance the interfaces implemented by this instance of WebDriver iff that instance is a
RemoteWebDriver . |
protected abstract <X> X |
create(RemoteWebDriver driver,
java.util.Map<java.lang.String,AugmenterProvider> augmentors,
X objectToAugment)
Subclasses should perform the requested augmentation.
|
protected abstract RemoteWebDriver |
extractRemoteWebDriver(org.openqa.selenium.WebDriver driver)
Subclasses should extract the remote webdriver or return null if it can't extract it.
|
private final java.util.Map<java.lang.String,AugmenterProvider> driverAugmentors
private final java.util.Map<java.lang.String,AugmenterProvider> elementAugmentors
public void addDriverAugmentation(java.lang.String capabilityName, AugmenterProvider handlerClass)
WebDriver
. For example (@link
CapabilityType#SUPPORTS_FINDING_BY_CSS} represents the interface
FindsByCssSelector
, which is implemented via the
AddFindsByCss
provider.
Note: This method is still experimental. Use at your own risk.capabilityName
- The name of the capability to modelhandlerClass
- The provider of the interface and implementationpublic void addElementAugmentation(java.lang.String capabilityName, AugmenterProvider handlerClass)
WebElement
. For example (@link
CapabilityType#SUPPORTS_FINDING_BY_CSS} represents the interface
FindsByCssSelector
, which is implemented via the
AddFindsByCss
provider.
Note: This method is still experimental. Use at your own risk.capabilityName
- The name of the capability to modelhandlerClass
- The provider of the interface and implementationpublic org.openqa.selenium.WebDriver augment(org.openqa.selenium.WebDriver driver)
RemoteWebDriver
.
The WebDriver that is returned may well be a dynamic proxy. You cannot rely on the concrete
implementing class to remain constant.driver
- The driver to enhancepublic org.openqa.selenium.WebElement augment(RemoteWebElement element)
RemoteWebElement
.
The WebElement that is returned may well be a dynamic proxy. You cannot rely on the concrete
implementing class to remain constant.element
- The driver to enhance.protected abstract <X> X create(RemoteWebDriver driver, java.util.Map<java.lang.String,AugmenterProvider> augmentors, X objectToAugment)
X
- typically a RemoteWebDriver or RemoteWebElementaugmentors
- augumentors to augment the objectdriver
- RWD instanceobjectToAugment
- object to augmentprotected abstract RemoteWebDriver extractRemoteWebDriver(org.openqa.selenium.WebDriver driver)
driver
- WebDriver instance to extract