Package org.fluentlenium.core.hook
Class BaseHook<T>
- java.lang.Object
-
- org.fluentlenium.core.FluentControlImpl
-
- org.fluentlenium.core.DefaultFluentContainer
-
- org.fluentlenium.core.hook.BaseHook<T>
-
- Type Parameters:
T
- type of options for the hook
- All Implemented Interfaces:
Configuration
,ConfigurationMutator
,ConfigurationProperties
,InputControl
,AlertControl
,CapabilitiesControl
,ComponentInstantiator
,CssControl
,EventsControl
,FluentContainer
,FluentControl
,FluentHook<T>
,FluentInjectControl
,NavigationControl
,PerformanceTimingControl
,JavascriptControl
,SearchControl<FluentWebElement>
,SeleniumDriverControl
,SnapshotControl
,AwaitControl
,org.openqa.selenium.interactions.Locatable
,org.openqa.selenium.internal.WrapsElement
,org.openqa.selenium.SearchContext
,org.openqa.selenium.support.pagefactory.ElementLocator
,org.openqa.selenium.TakesScreenshot
,org.openqa.selenium.WebElement
,org.openqa.selenium.WrapsElement
- Direct Known Subclasses:
BaseFluentHook
public class BaseHook<T> extends DefaultFluentContainer implements FluentHook<T>
Base hook implementation.You should extends this class to implement your own hook.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.fluentlenium.configuration.ConfigurationProperties
ConfigurationProperties.DriverLifecycle, ConfigurationProperties.TriggerMode
-
-
Field Summary
-
Fields inherited from class org.fluentlenium.core.DefaultFluentContainer
control
-
-
Constructor Summary
Constructors Constructor Description BaseHook(FluentControl control, ComponentInstantiator instantiator, java.util.function.Supplier<org.openqa.selenium.WebElement> elementSupplier, java.util.function.Supplier<org.openqa.selenium.support.pagefactory.ElementLocator> locatorSupplier, java.util.function.Supplier<java.lang.String> toStringSupplier, T options)
Creates a new base hook.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
void
click()
org.openqa.selenium.WebElement
findElement()
org.openqa.selenium.WebElement
findElement(org.openqa.selenium.By by)
java.util.List<org.openqa.selenium.WebElement>
findElements()
java.util.List<org.openqa.selenium.WebElement>
findElements(org.openqa.selenium.By by)
java.lang.String
getAttribute(java.lang.String name)
org.openqa.selenium.interactions.Coordinates
getCoordinates()
Get coordinates of the underlying element.java.lang.String
getCssValue(java.lang.String propertyName)
org.openqa.selenium.WebElement
getElement()
Get the underlying element of the hook.org.openqa.selenium.support.pagefactory.ElementLocator
getElementLocator()
Get the underlying element locator of the hook.ComponentInstantiator
getInstantiator()
Get the component instantiator.org.openqa.selenium.Point
getLocation()
T
getOptions()
Get the options of the hook.org.openqa.selenium.Rectangle
getRect()
<X> X
getScreenshotAs(org.openqa.selenium.OutputType<X> outputType)
org.openqa.selenium.Dimension
getSize()
java.lang.String
getTagName()
java.lang.String
getText()
org.openqa.selenium.WebElement
getWrappedElement()
boolean
isDisplayed()
boolean
isEnabled()
boolean
isSelected()
protected T
newOptions()
Builds default options.void
sendKeys(java.lang.CharSequence... charSequences)
void
submit()
java.lang.String
toString()
-
Methods inherited from class org.fluentlenium.core.DefaultFluentContainer
getDriver, getFluentControl, initFluent
-
Methods inherited from class org.fluentlenium.core.FluentControlImpl
alert, asComponentList, asComponentList, asComponentList, asComponentList, asComponentList, asComponentList, asFluentList, asFluentList, asFluentList, asFluentList, asFluentList, asFluentList, await, canTakeScreenShot, capabilities, css, el, events, executeAsyncScript, executeScript, find, find, find, find, getAwaitAtMost, getAwaitPollingEvery, getBaseUrl, getBrowserTimeout, getBrowserTimeoutRetries, getCapabilities, getConfiguration, getConfigurationDefaults, getConfigurationFactory, getControlContainer, getCookie, getCookies, getCustomProperty, getDeleteCookies, getDriverLifecycle, getEventsEnabled, getHtmlDumpMode, getHtmlDumpPath, getImplicitlyWait, getPageLoadTimeout, getRemoteUrl, getScreenshotMode, getScreenshotPath, getScriptTimeout, getWebDriver, goTo, goTo, goToInNewTab, inject, injectComponent, isComponentClass, isComponentListClass, keyboard, mouse, newComponent, newComponentList, newComponentList, newComponentList, newComponentList, newComponentList, newComponentList, newFluent, newFluentList, newFluentList, newFluentList, newFluentList, newFluentList, newFluentList, newInstance, pageSource, performanceTiming, setAwaitAtMost, setAwaitPollingEvery, setBaseUrl, setBrowserTimeout, setBrowserTimeoutRetries, setCapabilities, setConfigurationFactory, setCustomProperty, setDeleteCookies, setDriverLifecycle, setEventsEnabled, setHtmlDumpMode, setHtmlDumpPath, setImplicitlyWait, setPageLoadTimeout, setRemoteUrl, setScreenshotMode, setScreenshotPath, setScriptTimeout, setWebDriver, switchTo, switchTo, switchTo, switchToDefault, takeHtmlDump, takeHtmlDump, takeScreenshot, takeScreenshot, url, window
-
-
-
-
Constructor Detail
-
BaseHook
public BaseHook(FluentControl control, ComponentInstantiator instantiator, java.util.function.Supplier<org.openqa.selenium.WebElement> elementSupplier, java.util.function.Supplier<org.openqa.selenium.support.pagefactory.ElementLocator> locatorSupplier, java.util.function.Supplier<java.lang.String> toStringSupplier, T options)
Creates a new base hook.- Parameters:
control
- control interfaceinstantiator
- component instantiatorelementSupplier
- element supplierlocatorSupplier
- element locator suppliertoStringSupplier
- element toString supplieroptions
- hook options
-
-
Method Detail
-
getElement
public final org.openqa.selenium.WebElement getElement()
Get the underlying element of the hook.Can be another hook, or a real element.
- Returns:
- underlying element
-
getWrappedElement
public org.openqa.selenium.WebElement getWrappedElement()
- Specified by:
getWrappedElement
in interfaceorg.openqa.selenium.WrapsElement
-
getElementLocator
public final org.openqa.selenium.support.pagefactory.ElementLocator getElementLocator()
Get the underlying element locator of the hook.- Returns:
- underlying element locator
-
getCoordinates
public org.openqa.selenium.interactions.Coordinates getCoordinates()
Get coordinates of the underlying element.- Specified by:
getCoordinates
in interfaceorg.openqa.selenium.interactions.Locatable
- Returns:
- coordinates of underlying element
-
newOptions
protected T newOptions()
Builds default options.- Returns:
- default options
-
getInstantiator
public ComponentInstantiator getInstantiator()
Get the component instantiator.- Returns:
- component instantiator
-
getOptions
public T getOptions()
Description copied from interface:FluentHook
Get the options of the hook.- Specified by:
getOptions
in interfaceFluentHook<T>
- Returns:
- hook options
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
sendKeys
public void sendKeys(java.lang.CharSequence... charSequences)
- Specified by:
sendKeys
in interfaceorg.openqa.selenium.WebElement
-
getScreenshotAs
public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> outputType) throws org.openqa.selenium.WebDriverException
- Specified by:
getScreenshotAs
in interfaceorg.openqa.selenium.TakesScreenshot
- Throws:
org.openqa.selenium.WebDriverException
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
- Specified by:
findElement
in interfaceorg.openqa.selenium.SearchContext
- Specified by:
findElement
in interfaceorg.openqa.selenium.WebElement
-
isSelected
public boolean isSelected()
- Specified by:
isSelected
in interfaceorg.openqa.selenium.WebElement
-
getRect
public org.openqa.selenium.Rectangle getRect()
- Specified by:
getRect
in interfaceorg.openqa.selenium.WebElement
-
isDisplayed
public boolean isDisplayed()
- Specified by:
isDisplayed
in interfaceorg.openqa.selenium.WebElement
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in interfaceorg.openqa.selenium.WebElement
-
findElements
public java.util.List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
- Specified by:
findElements
in interfaceorg.openqa.selenium.SearchContext
- Specified by:
findElements
in interfaceorg.openqa.selenium.WebElement
-
submit
public void submit()
- Specified by:
submit
in interfaceorg.openqa.selenium.WebElement
-
getCssValue
public java.lang.String getCssValue(java.lang.String propertyName)
- Specified by:
getCssValue
in interfaceorg.openqa.selenium.WebElement
-
getTagName
public java.lang.String getTagName()
- Specified by:
getTagName
in interfaceorg.openqa.selenium.WebElement
-
getLocation
public org.openqa.selenium.Point getLocation()
- Specified by:
getLocation
in interfaceorg.openqa.selenium.WebElement
-
getSize
public org.openqa.selenium.Dimension getSize()
- Specified by:
getSize
in interfaceorg.openqa.selenium.WebElement
-
getText
public java.lang.String getText()
- Specified by:
getText
in interfaceorg.openqa.selenium.WebElement
-
click
public void click()
- Specified by:
click
in interfaceorg.openqa.selenium.WebElement
-
getAttribute
public java.lang.String getAttribute(java.lang.String name)
- Specified by:
getAttribute
in interfaceorg.openqa.selenium.WebElement
-
clear
public void clear()
- Specified by:
clear
in interfaceorg.openqa.selenium.WebElement
-
findElement
public org.openqa.selenium.WebElement findElement()
- Specified by:
findElement
in interfaceorg.openqa.selenium.support.pagefactory.ElementLocator
-
findElements
public java.util.List<org.openqa.selenium.WebElement> findElements()
- Specified by:
findElements
in interfaceorg.openqa.selenium.support.pagefactory.ElementLocator
-
-