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,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 voidclear()voidclick()org.openqa.selenium.WebElementfindElement()org.openqa.selenium.WebElementfindElement(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.StringgetAttribute(java.lang.String name)org.openqa.selenium.interactions.CoordinatesgetCoordinates()Get coordinates of the underlying element.java.lang.StringgetCssValue(java.lang.String propertyName)org.openqa.selenium.WebElementgetElement()Get the underlying element of the hook.org.openqa.selenium.support.pagefactory.ElementLocatorgetElementLocator()Get the underlying element locator of the hook.ComponentInstantiatorgetInstantiator()Get the component instantiator.org.openqa.selenium.PointgetLocation()TgetOptions()Get the options of the hook.org.openqa.selenium.RectanglegetRect()<X> XgetScreenshotAs(org.openqa.selenium.OutputType<X> outputType)org.openqa.selenium.DimensiongetSize()java.lang.StringgetTagName()java.lang.StringgetText()org.openqa.selenium.WebElementgetWrappedElement()booleanisDisplayed()booleanisEnabled()booleanisSelected()protected TnewOptions()Builds default options.voidsendKeys(java.lang.CharSequence... charSequences)voidsubmit()java.lang.StringtoString()-
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, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.fluentlenium.core.alert.AlertControl
alert
-
Methods inherited from interface org.fluentlenium.core.wait.AwaitControl
await
-
Methods inherited from interface org.fluentlenium.core.capabilities.CapabilitiesControl
capabilities
-
Methods inherited from interface org.fluentlenium.core.components.ComponentInstantiator
asComponentList, asComponentList, asComponentList, asComponentList, asComponentList, asComponentList, asFluentList, asFluentList, asFluentList, asFluentList, asFluentList, asFluentList, isComponentClass, isComponentListClass, newComponent, newComponentList, newComponentList, newComponentList, newComponentList, newComponentList, newComponentList, newFluent, newFluentList, newFluentList, newFluentList, newFluentList, newFluentList, newFluentList
-
Methods inherited from interface org.fluentlenium.configuration.ConfigurationMutator
setAwaitAtMost, setAwaitPollingEvery, setBaseUrl, setBrowserTimeout, setBrowserTimeoutRetries, setCapabilities, setConfigurationFactory, setCustomProperty, setDeleteCookies, setDriverLifecycle, setEventsEnabled, setHtmlDumpMode, setHtmlDumpPath, setImplicitlyWait, setPageLoadTimeout, setRemoteUrl, setScreenshotMode, setScreenshotPath, setScriptTimeout, setWebDriver
-
Methods inherited from interface org.fluentlenium.configuration.ConfigurationProperties
getAwaitAtMost, getAwaitPollingEvery, getBaseUrl, getBrowserTimeout, getBrowserTimeoutRetries, getCapabilities, getConfigurationDefaults, getConfigurationFactory, getCustomProperty, getDeleteCookies, getDriverLifecycle, getEventsEnabled, getHtmlDumpMode, getHtmlDumpPath, getImplicitlyWait, getPageLoadTimeout, getRemoteUrl, getScreenshotMode, getScreenshotPath, getScriptTimeout, getWebDriver
-
Methods inherited from interface org.fluentlenium.core.css.CssControl
css
-
Methods inherited from interface org.fluentlenium.core.events.EventsControl
events
-
Methods inherited from interface org.fluentlenium.core.inject.FluentInjectControl
inject, injectComponent, newInstance
-
Methods inherited from interface org.fluentlenium.core.action.InputControl
keyboard, mouse
-
Methods inherited from interface org.fluentlenium.core.script.JavascriptControl
executeAsyncScript, executeScript
-
Methods inherited from interface org.fluentlenium.core.navigation.NavigationControl
getCookie, getCookies, goTo, goTo, goToInNewTab, pageSource, switchTo, switchTo, switchTo, switchToDefault, url, window
-
Methods inherited from interface org.fluentlenium.core.search.SearchControl
$, $, $, $, el, el, el, el, find, find, find, find
-
Methods inherited from interface org.fluentlenium.core.snapshot.SnapshotControl
canTakeScreenShot, takeHtmlDump, takeHtmlDump, takeScreenshot, takeScreenshot
-
-
-
-
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:
getWrappedElementin 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:
getCoordinatesin interfaceorg.openqa.selenium.interactions.Locatable- Returns:
- cooridnates 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:FluentHookGet the options of the hook.- Specified by:
getOptionsin interfaceFluentHook<T>- Returns:
- hook options
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
sendKeys
public void sendKeys(java.lang.CharSequence... charSequences)
- Specified by:
sendKeysin interfaceorg.openqa.selenium.WebElement
-
getScreenshotAs
public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> outputType) throws org.openqa.selenium.WebDriverException- Specified by:
getScreenshotAsin interfaceorg.openqa.selenium.TakesScreenshot- Throws:
org.openqa.selenium.WebDriverException
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
- Specified by:
findElementin interfaceorg.openqa.selenium.SearchContext- Specified by:
findElementin interfaceorg.openqa.selenium.WebElement
-
isSelected
public boolean isSelected()
- Specified by:
isSelectedin interfaceorg.openqa.selenium.WebElement
-
getRect
public org.openqa.selenium.Rectangle getRect()
- Specified by:
getRectin interfaceorg.openqa.selenium.WebElement
-
isDisplayed
public boolean isDisplayed()
- Specified by:
isDisplayedin interfaceorg.openqa.selenium.WebElement
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceorg.openqa.selenium.WebElement
-
findElements
public java.util.List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
- Specified by:
findElementsin interfaceorg.openqa.selenium.SearchContext- Specified by:
findElementsin interfaceorg.openqa.selenium.WebElement
-
submit
public void submit()
- Specified by:
submitin interfaceorg.openqa.selenium.WebElement
-
getCssValue
public java.lang.String getCssValue(java.lang.String propertyName)
- Specified by:
getCssValuein interfaceorg.openqa.selenium.WebElement
-
getTagName
public java.lang.String getTagName()
- Specified by:
getTagNamein interfaceorg.openqa.selenium.WebElement
-
getLocation
public org.openqa.selenium.Point getLocation()
- Specified by:
getLocationin interfaceorg.openqa.selenium.WebElement
-
getSize
public org.openqa.selenium.Dimension getSize()
- Specified by:
getSizein interfaceorg.openqa.selenium.WebElement
-
getText
public java.lang.String getText()
- Specified by:
getTextin interfaceorg.openqa.selenium.WebElement
-
click
public void click()
- Specified by:
clickin interfaceorg.openqa.selenium.WebElement
-
getAttribute
public java.lang.String getAttribute(java.lang.String name)
- Specified by:
getAttributein interfaceorg.openqa.selenium.WebElement
-
clear
public void clear()
- Specified by:
clearin interfaceorg.openqa.selenium.WebElement
-
findElement
public org.openqa.selenium.WebElement findElement()
- Specified by:
findElementin interfaceorg.openqa.selenium.support.pagefactory.ElementLocator
-
findElements
public java.util.List<org.openqa.selenium.WebElement> findElements()
- Specified by:
findElementsin interfaceorg.openqa.selenium.support.pagefactory.ElementLocator
-
-