Class GuiElement
- java.lang.Object
-
- eu.tsystems.mms.tic.testframework.pageobjects.GuiElement
-
- All Implemented Interfaces:
eu.tsystems.mms.tic.testframework.internal.Nameable<UiElement>,eu.tsystems.mms.tic.testframework.internal.NameableChild<UiElement>,eu.tsystems.mms.tic.testframework.logging.Loggable,InteractiveUiElement,InteractiveWebElementActions,UiElementBase,UiElementActions,WebElementActions,WebElementRetainer,LocatorFactoryProvider,PageObject<UiElement>,TestableUiElement,UiElement,UiElementFinder,WebDriverManagerProvider,WebDriverRetainer
- Direct Known Subclasses:
EmptyUiElement
public class GuiElement extends java.lang.Object implements UiElement, eu.tsystems.mms.tic.testframework.internal.NameableChild<UiElement>, eu.tsystems.mms.tic.testframework.logging.Loggable, WebDriverManagerProvider
GuiElement is the access point for most tests and is an extension of WebElement.Authors: pele, rnhb
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface eu.tsystems.mms.tic.testframework.pageobjects.UiElement
UiElement.Properties
-
-
Field Summary
-
Fields inherited from interface eu.tsystems.mms.tic.testframework.pageobjects.LocatorFactoryProvider
LOCATE
-
Fields inherited from interface eu.tsystems.mms.tic.testframework.testing.WebDriverManagerProvider
WEB_DRIVER_MANAGER
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGuiElement(GuiElementData data, GuiElementCore core)GuiElement(org.openqa.selenium.WebDriver driver, Locator locator)Deprecated.GuiElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By by)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TestableUiElementanyElementContainsText(java.lang.String text)Deprecated.booleananyFollowingTextNodeContains(java.lang.String contains)Deprecated.GuiElementAssertassertCollector()Deprecated.Useasserts()insteadGuiElementAssertassertCollector(java.lang.String errorMessage)Deprecated.GuiElementAssertasserts()Deprecated.GuiElementAssertasserts(java.lang.String errorMessage)Deprecated.UiElementclear()Deprecated.This method is no longer acceptable as a part of GuiElement.UiElementclick()UiElementcontextClick()Deprecated.This method is no longer acceptable as a part of GuiElement.UiElementcreateEmpty(Locator locator)java.lang.StringcreateXPath()Creates a xpath of the givenLocatorhierarchy NOT the actual element hierarchyUiElementdeselect()UiElementdoubleClick()UiElementAssertionexpect()ThrowsAssertionErrorwhen condition not matchedUiElementfind(Locator locator)voidfindWebElement(java.util.function.Consumer<org.openqa.selenium.WebElement> consumer)Supplies the first found filteredWebElementto a consumer.java.lang.StringgetAttribute(java.lang.String attributeName)Deprecated.org.openqa.selenium.BygetBy()Deprecated.GuiElementCoregetCore()Returns the raw core without any decoratorsjava.lang.StringgetCssValue(java.lang.String cssIdentifier)Deprecated.This method is no longer acceptable as a part of GuiElement.GuiElementDatagetData()org.openqa.selenium.WebDrivergetDriver()Deprecated.intgetLengthOfValueAfterSendKeys(java.lang.String textToInput)Deprecated.java.util.List<GuiElement>getList()Deprecated.org.openqa.selenium.PointgetLocation()Deprecated.LocatorgetLocator()java.lang.StringgetName(boolean detailed)intgetNumberOfFoundElements()Deprecated.eu.tsystems.mms.tic.testframework.internal.NameablegetParent()Retrieves the nameable parent.org.openqa.selenium.support.ui.SelectgetSelectElement()Deprecated.org.openqa.selenium.DimensiongetSize()Deprecated.GuiElementgetSubElement(Locator locator)Deprecated.GuiElementgetSubElement(org.openqa.selenium.By by)Deprecated.GuiElementgetSubElement(org.openqa.selenium.By by, java.lang.String description)Deprecated.java.lang.StringgetTagName()Deprecated.java.lang.StringgetText()Deprecated.java.util.List<java.lang.String>getTextsFromChildren()Deprecated.org.openqa.selenium.WebDrivergetWebDriver()org.openqa.selenium.WebElementgetWebElement()Deprecated.booleanhasOwnName()booleanhasSensibleData()Deprecated.UiElementhighlight(java.awt.Color color)Highlights the element with a specified colorInteractiveUiElementhover()Deprecated.This method is no longer acceptable as a part of GuiElement.booleanisDisplayed()Deprecated.booleanisEnabled()Deprecated.booleanisPresent()Deprecated.booleanisSelectable()Deprecated.booleanisSelected()Deprecated.booleanisVisible(boolean complete)Deprecated.UiElementList<UiElement>list()UiElementmouseOver()Deprecated.GuiElementAssertnonFunctionalAsserts()Deprecated.UseoptionalAsserts()insteadGuiElementAssertnonFunctionalAsserts(java.lang.String errorMessage)Deprecated.UseoptionalAsserts(String)insteadGuiElementAssertoptionalAsserts()Deprecated.GuiElementAssertoptionalAsserts(java.lang.String errorMessage)Deprecated.UiElementrightClick()Deprecated.UsecontextClick()insteadvoidscreenshotToReport()UiElementscrollIntoView(org.openqa.selenium.Point offset)Centers the element in the viewport with a given offsetUiElementscrollToElement()Deprecated.UiElementscrollToElement(int yOffset)Deprecated.UiElementscrollToTop()Scroll the element to the top of the viewportUiElementselect()UiElementsendKeys(java.lang.CharSequence... charSequences)GuiElementsensibleData()GuiElementsetDescription(java.lang.String description)Deprecated.UsesetName(String)insteadGuiElementsetName(java.lang.String name)UiElementsetParent(eu.tsystems.mms.tic.testframework.internal.Nameable parent)Sets the abstract parentGuiElementshadowRoot()Deprecated.UiElementsubmit()UiElementswipe(int offsetX, int offSetY)java.io.FiletakeScreenshot()Deprecated.java.lang.StringtoString()UiElementtype(java.lang.String text)UiElementAssertionwaitFor(int seconds)Doesn't throw anyAssertionErrorGuiElementWaitwaits()Deprecated.GuiElementwithWebElementFilter(java.util.function.Predicate<org.openqa.selenium.WebElement> filter)Deprecated.UseDefaultLocatorinstead-
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.InteractiveWebElementActions
select
-
Methods inherited from interface eu.tsystems.mms.tic.testframework.internal.Nameable
getName, toString, traceAncestors
-
Methods inherited from interface eu.tsystems.mms.tic.testframework.pageobjects.TestableUiElement
assertThat, waitFor
-
Methods inherited from interface eu.tsystems.mms.tic.testframework.pageobjects.UiElementFinder
createEmpty, find, find, findById, findByQa, findDeep, findDeep
-
Methods inherited from interface eu.tsystems.mms.tic.testframework.pageobjects.internal.WebElementActions
highlight, scrollIntoView
-
-
-
-
Constructor Detail
-
GuiElement
protected GuiElement(GuiElementData data, GuiElementCore core)
-
GuiElement
@Deprecated public GuiElement(org.openqa.selenium.WebDriver driver, Locator locator)Deprecated.
-
GuiElement
@Deprecated public GuiElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By by)Deprecated.
-
-
Method Detail
-
getCore
public GuiElementCore getCore()
Returns the raw core without any decorators
-
getData
public GuiElementData getData()
-
getLocator
public Locator getLocator()
- Specified by:
getLocatorin interfaceUiElementBase
-
withWebElementFilter
@Deprecated public GuiElement withWebElementFilter(java.util.function.Predicate<org.openqa.selenium.WebElement> filter)
Deprecated.UseDefaultLocatorinsteadAfter retrieving all WebElements of the given locator, this method can be used to filter the WebElements. Different filters can be applied in conjunction (and).- Parameters:
filter- Filters to be applied- Returns:
- The same GuiElement
-
setDescription
@Deprecated public GuiElement setDescription(java.lang.String description)
Deprecated.UsesetName(String)insteadAdd a Decorator to log every action performed on this element with addition to a short description of it.- Parameters:
description- A very short description of this GuiElement, for example "Continue Shopping Button"
-
getSubElement
@Deprecated public GuiElement getSubElement(org.openqa.selenium.By by)
Deprecated.Get sub element by locator. Using this executes a find on the parent element and the parent.findElement for the given locator. It does not wait for the subelement if the parent has been found!- Parameters:
by- Locator of new element.- Returns:
- GuiElement
-
getSubElement
@Deprecated public GuiElement getSubElement(org.openqa.selenium.By by, java.lang.String description)
Deprecated.Get sub element by locator. Using this executes a find on the parent element and the parent.findElement for the given locator. It does not wait for the subelement if the parent has been found!- Parameters:
by- Locator of new element.description- Description for GuiElement- Returns:
- GuiElement
-
getSubElement
@Deprecated public GuiElement getSubElement(Locator locator)
Deprecated.
-
scrollIntoView
public UiElement scrollIntoView(org.openqa.selenium.Point offset)
Description copied from interface:WebElementActionsCenters the element in the viewport with a given offset- Specified by:
scrollIntoViewin interfaceWebElementActions
-
scrollToTop
public UiElement scrollToTop()
Description copied from interface:WebElementActionsScroll the element to the top of the viewport- Specified by:
scrollToTopin interfaceWebElementActions
-
getBy
@Deprecated public org.openqa.selenium.By getBy()
Deprecated.
-
scrollToElement
@Deprecated public UiElement scrollToElement()
Deprecated.
-
scrollToElement
@Deprecated public UiElement scrollToElement(int yOffset)
Deprecated.
-
select
public UiElement select()
- Specified by:
selectin interfaceInteractiveWebElementActions
-
deselect
public UiElement deselect()
- Specified by:
deselectin interfaceInteractiveWebElementActions
-
type
public UiElement type(java.lang.String text)
- Specified by:
typein interfaceInteractiveWebElementActions
-
click
public UiElement click()
- Specified by:
clickin interfaceInteractiveWebElementActions
-
submit
public UiElement submit()
- Specified by:
submitin interfaceInteractiveWebElementActions
-
sendKeys
public UiElement sendKeys(java.lang.CharSequence... charSequences)
- Specified by:
sendKeysin interfaceInteractiveWebElementActions
-
clear
public UiElement clear()
Deprecated.This method is no longer acceptable as a part of GuiElement. Useeu.tsystems.mms.tic.testframework.webdrivermanager.DesktopWebDriverUtils#clickAbsolute()instead- Specified by:
clearin interfaceInteractiveWebElementActions
-
hover
public InteractiveUiElement hover()
Deprecated.This method is no longer acceptable as a part of GuiElement. Useeu.tsystems.mms.tic.testframework.webdrivermanager.DesktopWebDriverUtils#mouseOverAbsolute2Axis()instead- Specified by:
hoverin interfaceInteractiveWebElementActions
-
getTagName
@Deprecated public java.lang.String getTagName()
Deprecated.
-
getAttribute
@Deprecated public java.lang.String getAttribute(java.lang.String attributeName)
Deprecated.
-
isSelected
@Deprecated public boolean isSelected()
Deprecated.
-
isEnabled
@Deprecated public boolean isEnabled()
Deprecated.
-
getText
@Deprecated public java.lang.String getText()
Deprecated.
-
isDisplayed
@Deprecated public boolean isDisplayed()
Deprecated.
-
isVisible
@Deprecated public boolean isVisible(boolean complete)
Deprecated.
-
isSelectable
@Deprecated public boolean isSelectable()
Deprecated.Checks if the element is selectable.WARNING: To determine if the element is truly selectable, a selection or deselection will be done and reverted. Keep this in mind.
- Returns:
- true, if the element is selectable.
-
getLocation
@Deprecated public org.openqa.selenium.Point getLocation()
Deprecated.
-
getSize
@Deprecated public org.openqa.selenium.Dimension getSize()
Deprecated.
-
find
public UiElement find(Locator locator)
- Specified by:
findin interfaceUiElementFinder
-
createEmpty
public UiElement createEmpty(Locator locator)
- Specified by:
createEmptyin interfaceUiElementFinder
-
list
public UiElementList<UiElement> list()
-
getCssValue
@Deprecated public java.lang.String getCssValue(java.lang.String cssIdentifier)
Deprecated.This method is no longer acceptable as a part of GuiElement. Useeu.tsystems.mms.tic.testframework.webdrivermanager.DesktopWebDriverUtils#mouseOverJS()instead
-
mouseOver
@Deprecated public UiElement mouseOver()
Deprecated.
-
isPresent
@Deprecated public boolean isPresent()
Deprecated.
-
getTextsFromChildren
@Deprecated public java.util.List<java.lang.String> getTextsFromChildren()
Deprecated.
-
anyFollowingTextNodeContains
@Deprecated public boolean anyFollowingTextNodeContains(java.lang.String contains)
Deprecated.
-
anyElementContainsText
@Deprecated public TestableUiElement anyElementContainsText(java.lang.String text)
Deprecated.This method is no part of any interface, because we don't know if we want to support this feature at the moment. The better approach is to useUiElementFinder.find(XPath)
-
getWebDriver
public org.openqa.selenium.WebDriver getWebDriver()
- Specified by:
getWebDriverin interfaceWebDriverRetainer
-
getWebElement
@Deprecated public org.openqa.selenium.WebElement getWebElement()
Deprecated.It's dangerous to use this method and rely on the givenWebElementbecause it can become stale during the execution. UsefindWebElement(Consumer)instead.
-
doubleClick
public UiElement doubleClick()
- Specified by:
doubleClickin interfaceInteractiveWebElementActions
-
highlight
public UiElement highlight(java.awt.Color color)
Description copied from interface:WebElementActionsHighlights the element with a specified color- Specified by:
highlightin interfaceWebElementActions
-
swipe
public UiElement swipe(int offsetX, int offSetY)
-
getLengthOfValueAfterSendKeys
@Deprecated public int getLengthOfValueAfterSendKeys(java.lang.String textToInput)
Deprecated.
-
getNumberOfFoundElements
@Deprecated public int getNumberOfFoundElements()
Deprecated.
-
rightClick
@Deprecated public UiElement rightClick()
Deprecated.UsecontextClick()instead
-
contextClick
public UiElement contextClick()
Deprecated.This method is no longer acceptable as a part of GuiElement. Useeu.tsystems.mms.tic.testframework.webdrivermanager.DesktopWebDriverUtils#doubleClickJS()instead- Specified by:
contextClickin interfaceInteractiveWebElementActions
-
takeScreenshot
@Deprecated public java.io.File takeScreenshot()
Deprecated.
-
setParent
public UiElement setParent(eu.tsystems.mms.tic.testframework.internal.Nameable parent)
Sets the abstract parent- Specified by:
setParentin interfaceeu.tsystems.mms.tic.testframework.internal.NameableChild<UiElement>- Parameters:
parent-UiElementorPageObject
-
getParent
public eu.tsystems.mms.tic.testframework.internal.Nameable getParent()
Retrieves the nameable parent.- Specified by:
getParentin interfaceeu.tsystems.mms.tic.testframework.internal.Nameable<UiElement>- Returns:
- Can be
UiElementorPageObject
-
hasOwnName
public boolean hasOwnName()
- Specified by:
hasOwnNamein interfaceeu.tsystems.mms.tic.testframework.internal.Nameable<UiElement>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getDriver
@Deprecated public org.openqa.selenium.WebDriver getDriver()
Deprecated.
-
hasSensibleData
@Deprecated public boolean hasSensibleData()
Deprecated.
-
sensibleData
public GuiElement sensibleData()
- Specified by:
sensibleDatain interfaceUiElement
-
setName
public GuiElement setName(java.lang.String name)
- Specified by:
setNamein interfaceeu.tsystems.mms.tic.testframework.internal.Nameable<UiElement>
-
getName
public java.lang.String getName(boolean detailed)
- Specified by:
getNamein interfaceeu.tsystems.mms.tic.testframework.internal.Nameable<UiElement>
-
asserts
@Deprecated public GuiElementAssert asserts()
Deprecated.Provides access to all functional assert methods.- Returns:
- GuiElementAssert object for functional assertions
-
asserts
@Deprecated public GuiElementAssert asserts(java.lang.String errorMessage)
Deprecated.Provides access to all assert methods. If an assertion fails, the assertDescription will be given as cause, instead of the technical cause like an isDisplayed error.- Parameters:
errorMessage- Cause returned on assertion error.- Returns:
- GuiElementAssert object for functional assertions
-
nonFunctionalAsserts
@Deprecated public GuiElementAssert nonFunctionalAsserts()
Deprecated.UseoptionalAsserts()insteadProvides access to all non-functional assert methods.- Returns:
- GuiElementAssert object for non-functional assertions
-
nonFunctionalAsserts
@Deprecated public GuiElementAssert nonFunctionalAsserts(java.lang.String errorMessage)
Deprecated.UseoptionalAsserts(String)insteadProvides access to all non-functional assert methods. If an assertion fails, the assertDescription will be given as cause, instead of the technical cause like an isDisplayed error.- Parameters:
errorMessage- Cause returned on assertion error.- Returns:
- GuiElementAssert object for non-functional assertions
-
optionalAsserts
@Deprecated public GuiElementAssert optionalAsserts()
Deprecated.Provides access to optional assert methods
-
optionalAsserts
@Deprecated public GuiElementAssert optionalAsserts(java.lang.String errorMessage)
Deprecated.Provides access to optional assert methods
-
assertCollector
@Deprecated public GuiElementAssert assertCollector()
Deprecated.Useasserts()insteadProvides access to all functional assert methods.- Returns:
- GuiElementAssert object for functional assertions
-
assertCollector
@Deprecated public GuiElementAssert assertCollector(java.lang.String errorMessage)
Deprecated.Provides access to all assert methods. If an assertion fails, the assertDescription will be given as cause, instead of the technical cause like an isDisplayed error.- Parameters:
errorMessage- Cause returned on assertion error.- Returns:
- GuiElementAssert object for functional assertions
-
getList
@Deprecated public java.util.List<GuiElement> getList()
Deprecated.
-
shadowRoot
@Deprecated public GuiElement shadowRoot()
Deprecated.- Specified by:
shadowRootin interfaceUiElement
-
waits
@Deprecated public GuiElementWait waits()
Deprecated.Provides access to all wait methods
-
waitFor
public UiElementAssertion waitFor(int seconds)
Description copied from interface:UiElementBaseDoesn't throw anyAssertionError- Specified by:
waitForin interfaceTestableUiElement- Specified by:
waitForin interfaceUiElementBase
-
expect
public UiElementAssertion expect()
Description copied from interface:UiElementBaseThrowsAssertionErrorwhen condition not matched- Specified by:
expectin interfaceTestableUiElement- Specified by:
expectin interfaceUiElementBase
-
createXPath
public java.lang.String createXPath()
Description copied from interface:UiElementBaseCreates a xpath of the givenLocatorhierarchy NOT the actual element hierarchy- Specified by:
createXPathin interfaceUiElementBase
-
findWebElement
public void findWebElement(java.util.function.Consumer<org.openqa.selenium.WebElement> consumer)
Description copied from interface:WebElementRetainerSupplies the first found filteredWebElementto a consumer. This makes sure that the element is present it it's current scope and not stale- Specified by:
findWebElementin interfaceWebElementRetainer
-
screenshotToReport
public void screenshotToReport()
- Specified by:
screenshotToReportin interfacePageObject<UiElement>
-
getSelectElement
@Deprecated public org.openqa.selenium.support.ui.Select getSelectElement()
Deprecated.
-
-