Class AbstractWebDriverCore
- java.lang.Object
-
- eu.tsystems.mms.tic.testframework.pageobjects.internal.core.AbstractGuiElementCore
-
- eu.tsystems.mms.tic.testframework.pageobjects.internal.core.AbstractWebDriverCore
-
- All Implemented Interfaces:
eu.tsystems.mms.tic.testframework.logging.Loggable,GuiElementCore,GuiElementCoreActions,WebElementRetainer
public abstract class AbstractWebDriverCore extends AbstractGuiElementCore implements eu.tsystems.mms.tic.testframework.logging.Loggable
-
-
Field Summary
-
Fields inherited from class eu.tsystems.mms.tic.testframework.pageobjects.internal.core.AbstractGuiElementCore
guiElementData
-
-
Constructor Summary
Constructors Constructor Description AbstractWebDriverCore(GuiElementData guiElementData)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()voidclick()voidcontextClick()voiddeselect()voiddoubleClick()doubleclickvoidfindWebElement(java.util.function.Consumer<org.openqa.selenium.WebElement> consumer)Finds theWebElementfrom a list of web elements according to it's selector index inGuiElementData.getIndex().java.lang.StringgetAttribute(java.lang.String attributeName)WebElement.getAttribute.java.lang.StringgetCssValue(java.lang.String cssIdentifier)WebElement.getCssValue.intgetLengthOfValueAfterSendKeys(java.lang.String textToInput)Types your text and returns the length of the attribute 'value' afterwards.org.openqa.selenium.PointgetLocation()WebElement.getLocation.intgetNumberOfFoundElements()A given location strategy (Locator + WebElementFilter) can match to many elements in a Website.org.openqa.selenium.RectanglegetRect()Gets the element's rectangleorg.openqa.selenium.DimensiongetSize()WebElement.getSize.java.lang.StringgetTagName()WebElement.getTagName.java.lang.StringgetText()Calls WebElement.getText.java.util.List<java.lang.String>getTextsFromChildren()Returns with all texts of child-elements.voidhighlight(java.awt.Color color)protected voidhighlightWebElement(org.openqa.selenium.WebElement webElement, java.awt.Color color)voidhover()booleanisDisplayed()WebElement.isDisplayed.booleanisEnabled()WebElement.isEnabled.booleanisPresent()Checks if an element is found by webdriver.booleanisSelectable()Checks if the element is selectable.booleanisSelected()WebElement.isSelected.booleanisVisible(boolean fullyVisible)Checks if the element is visible in the current viewportvoidscrollIntoView(org.openqa.selenium.Point offset)voidscrollToElement(int yOffset)voidscrollToTop()voidselect()voidsendKeys(java.lang.CharSequence... charSequences)voidsubmit()abstract voidswipe(int offsetX, int offSetY)Swipe the element by the given offset.protected abstract voidswitchToDefaultContent(org.openqa.selenium.WebDriver webDriver)protected abstract voidswitchToFrame(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)java.io.FiletakeScreenshot()Takes a screenshot of the GuiElementjava.lang.StringtoString()Build a nice string.voidtype(java.lang.String text)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface eu.tsystems.mms.tic.testframework.pageobjects.internal.core.GuiElementCore
getWebElement
-
Methods inherited from interface eu.tsystems.mms.tic.testframework.pageobjects.internal.core.GuiElementCoreActions
mouseOver, rightClick, scrollIntoView, scrollToElement, select
-
-
-
-
Constructor Detail
-
AbstractWebDriverCore
public AbstractWebDriverCore(GuiElementData guiElementData)
-
-
Method Detail
-
switchToDefaultContent
protected abstract void switchToDefaultContent(org.openqa.selenium.WebDriver webDriver)
-
switchToFrame
protected abstract void switchToFrame(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)
-
findWebElement
public void findWebElement(java.util.function.Consumer<org.openqa.selenium.WebElement> consumer)
Finds theWebElementfrom a list of web elements according to it's selector index inGuiElementData.getIndex(). Also prepares shadow roots byGuiElementData.isShadowRoot()More information seeWebElementRetainer.findWebElement(Consumer)- Specified by:
findWebElementin interfaceWebElementRetainer
-
scrollToElement
public void scrollToElement(int yOffset)
- Specified by:
scrollToElementin interfaceGuiElementCoreActions
-
scrollIntoView
public void scrollIntoView(org.openqa.selenium.Point offset)
- Specified by:
scrollIntoViewin interfaceGuiElementCoreActions
-
scrollToTop
public void scrollToTop()
- Specified by:
scrollToTopin interfaceGuiElementCoreActions
-
select
public void select()
- Specified by:
selectin interfaceGuiElementCoreActions
-
deselect
public void deselect()
- Specified by:
deselectin interfaceGuiElementCoreActions
-
type
public void type(java.lang.String text)
- Specified by:
typein interfaceGuiElementCoreActions
-
click
public void click()
- Specified by:
clickin interfaceGuiElementCoreActions
-
submit
public void submit()
- Specified by:
submitin interfaceGuiElementCoreActions
-
sendKeys
public void sendKeys(java.lang.CharSequence... charSequences)
- Specified by:
sendKeysin interfaceGuiElementCoreActions
-
clear
public void clear()
- Specified by:
clearin interfaceGuiElementCoreActions
-
getTagName
public java.lang.String getTagName()
Description copied from interface:GuiElementCoreWebElement.getTagName.- Specified by:
getTagNamein interfaceGuiElementCore- Returns:
- The tag name as String.
-
getAttribute
public java.lang.String getAttribute(java.lang.String attributeName)
Description copied from interface:GuiElementCoreWebElement.getAttribute.- Specified by:
getAttributein interfaceGuiElementCore- Parameters:
attributeName- Name of the attribute.- Returns:
- The value of the attribute.
-
isSelected
public boolean isSelected()
Description copied from interface:GuiElementCoreWebElement.isSelected.- Specified by:
isSelectedin interfaceGuiElementCore- Returns:
- true if element is selected.
-
isEnabled
public boolean isEnabled()
Description copied from interface:GuiElementCoreWebElement.isEnabled.- Specified by:
isEnabledin interfaceGuiElementCore- Returns:
- true if element is enabled.
-
getText
public java.lang.String getText()
Description copied from interface:GuiElementCoreCalls WebElement.getText. Please note that this will only return a String, if the elements text is actually visible.- Specified by:
getTextin interfaceGuiElementCore- Returns:
- text of the element.
-
isDisplayed
public boolean isDisplayed()
Description copied from interface:GuiElementCoreWebElement.isDisplayed.- Specified by:
isDisplayedin interfaceGuiElementCore- Returns:
- true if element is displayed.
-
getRect
public org.openqa.selenium.Rectangle getRect()
Description copied from interface:GuiElementCoreGets the element's rectangle- Specified by:
getRectin interfaceGuiElementCore
-
isVisible
public boolean isVisible(boolean fullyVisible)
Description copied from interface:GuiElementCoreChecks if the element is visible in the current viewport- Specified by:
isVisiblein interfaceGuiElementCore- Returns:
-
isSelectable
public boolean isSelectable()
Description copied from interface:GuiElementCoreChecks if the element is selectable.- Specified by:
isSelectablein interfaceGuiElementCore- Returns:
- ture, if the element is selectable
-
getLocation
public org.openqa.selenium.Point getLocation()
Description copied from interface:GuiElementCoreWebElement.getLocation.- Specified by:
getLocationin interfaceGuiElementCore- Returns:
- The location of the webelement.
-
getSize
public org.openqa.selenium.Dimension getSize()
Description copied from interface:GuiElementCoreWebElement.getSize.- Specified by:
getSizein interfaceGuiElementCore- Returns:
- Size of the webelement.
-
getCssValue
public java.lang.String getCssValue(java.lang.String cssIdentifier)
Description copied from interface:GuiElementCoreWebElement.getCssValue.- Specified by:
getCssValuein interfaceGuiElementCore- Parameters:
cssIdentifier- .- Returns:
- Css value of the webelement.
-
hover
public void hover()
- Specified by:
hoverin interfaceGuiElementCoreActions
-
highlightWebElement
protected void highlightWebElement(org.openqa.selenium.WebElement webElement, java.awt.Color color)
-
isPresent
public boolean isPresent()
Description copied from interface:GuiElementCoreChecks if an element is found by webdriver.- Specified by:
isPresentin interfaceGuiElementCore- Returns:
- true if found, false otherwise.
-
getTextsFromChildren
public java.util.List<java.lang.String> getTextsFromChildren()
Description copied from interface:GuiElementCoreReturns with all texts of child-elements.- Specified by:
getTextsFromChildrenin interfaceGuiElementCore- Returns:
- .
-
doubleClick
public void doubleClick()
Description copied from interface:GuiElementCoreActionsdoubleclick- Specified by:
doubleClickin interfaceGuiElementCoreActions
-
highlight
public void highlight(java.awt.Color color)
- Specified by:
highlightin interfaceGuiElementCoreActions
-
swipe
public abstract void swipe(int offsetX, int offSetY)Description copied from interface:GuiElementCoreActionsSwipe the element by the given offset. (0,0) should be the top left.- Specified by:
swipein interfaceGuiElementCoreActions- Parameters:
offsetX- horizontal offset in pixel.offSetY- vertical offset in pixel.
-
getLengthOfValueAfterSendKeys
public int getLengthOfValueAfterSendKeys(java.lang.String textToInput)
Description copied from interface:GuiElementCoreTypes your text and returns the length of the attribute 'value' afterwards. Can be useful to check a maximal input length- Specified by:
getLengthOfValueAfterSendKeysin interfaceGuiElementCore- Parameters:
textToInput- text to check- Returns:
- Length of the attribute 'value'
- See Also:
*
-
getNumberOfFoundElements
public int getNumberOfFoundElements()
Description copied from interface:GuiElementCoreA given location strategy (Locator + WebElementFilter) can match to many elements in a Website. This method returns that number. This can be useful for tests, that want to ensure that a GuiElement is found n times.- Specified by:
getNumberOfFoundElementsin interfaceGuiElementCore- Returns:
- The number, how many WebElements were identified by this GuiElement.
-
toString
public java.lang.String toString()
Build a nice string.- Overrides:
toStringin classjava.lang.Object- Returns:
- .
-
contextClick
public void contextClick()
- Specified by:
contextClickin interfaceGuiElementCoreActions
-
takeScreenshot
public java.io.File takeScreenshot()
Description copied from interface:GuiElementCoreTakes a screenshot of the GuiElement- Specified by:
takeScreenshotin interfaceGuiElementCore- Overrides:
takeScreenshotin classAbstractGuiElementCore- Returns:
- File object of the screenshot or NULL on error
-
-