Class DOMObjectValidator
java.lang.Object
org.uitnet.testing.smartfwk.ui.core.objects.UIObjectValidator
org.uitnet.testing.smartfwk.ui.core.objects.DOMObjectValidator
public class DOMObjectValidator extends UIObjectValidator
- Author:
- Madhav Krishna
-
Field Summary
Fields inherited from class org.uitnet.testing.smartfwk.ui.core.objects.UIObjectValidator
appDriver, region, uiObject -
Constructor Summary
Constructors Constructor Description DOMObjectValidator(SmartAppDriver appDriver, DOMObject domObject, org.sikuli.script.Region region) -
Method Summary
Modifier and Type Method Description DOMObjectValidatorclick(int maxIterationsToLocateElements)DOMObjectValidatorclickAndHold(int maxIterationsToLocateElements)DOMObjectValidatorcopyTextToClipboard(int maxIterationsToLocateElements)Copy text into clipboard from the current cursor position.DOMObjectValidatordoubleClick(int maxIterationsToLocateElements)DOMObjectValidatordragAndDrop(DOMObject target, int maxIterationsToLocateElements)org.openqa.selenium.WebElementfindElement(int maxIterationsToLocateElements)Finds first element with polling and it polls after 2 seconds for maxIterationsToLocateElements times.org.openqa.selenium.WebElementfindElementNoException(int maxIterationsToLocateElements)Finds first element with polling and it polls after 2 seconds for maxIterationsToLocateElements times.List<org.openqa.selenium.WebElement>findElements(int maxIterationsToLocateElements)This returns all the elements based on the locator.DOMObjectValidatorforceClick(int maxIterationsToLocateElements)StringgetAttributeValue(String attributeName, int maxIterationsToLocateElements)Returns the attribute value of the first element.StringgetAttributeValueWhenAttributeValueNonEmpty(String attributeName, int maxIterationsToLocateElements)Finds attribute value from visible element when it's value is not empty.StringgetAttributeValueWhenElementVisible(String attributeName, int maxIterationsToLocateElements)Finds attribute value from element when it is not hidden.org.openqa.selenium.interactions.ActionsgetNewSeleniumActions()StringgetText(int maxIterationsToLocateElements)Finds text from element when element is present in HTML.StringgetTextWhenElementValueNonEmpty(int maxIterationsToLocateElements)Finds text from visible element when it's value is not empty.StringgetTextWhenElementVisible(int maxIterationsToLocateElements)Finds text from element when it is not hidden.DOMObjectgetUIObject()booleanisDisabled(int maxIterationsToLocateElements)booleanisDisabledButNotReadonly(int maxIterationsToLocateElements)booleanisPresent(int maxIterationsToLocateElements)Return true only if first element is present but it might not be visible.booleanisReadonly(int maxIterationsToLocateElements)booleanisSelected(int maxIterationsToLocateElements)Determine whether or not this element is selected or not.booleanisVisible(int maxIterationsToLocateElements)Return true only if element is visible.DOMObjectValidatormouseHoverOver(int maxIterationsToLocateElements)DOMObjectValidatorpasteTextFromClipboard(int maxIterationsToLocateElements)Replace the content of the element with the clipboard contents.DOMObjectValidatorperformKeyDown(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)DOMObjectValidatorperformKeyPressed(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)DOMObjectValidatorperformKeyUp(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)DOMObjectValidatorrelease(int maxIterationsToLocateElements)DOMObjectValidatorrightClick(int maxIterationsToLocateElements)DOMObjectValidatorscrollElementOnViewport(ScrollbarSI scrollbar)DOMObjectValidatorsendKeys(int maxIterationsToLocateElements, CharSequence... keys)DOMObjectValidatortypeText(String text, NewTextLocation location, int maxIterationsToLocateElements)DOMObjectValidatortypeText(String text, NewTextLocation location, int typeSpeedInMspc, boolean clickBeforeType, int maxIterationsToLocateElements)Used to type the text on textbox and textarea componenets.voidtypeWithInterval(String textToType, int typeSpeedInMspc, org.openqa.selenium.WebElement webElem)DOMObjectValidatorvalidateElementPresentWithinArea(AreaCoordinates coordinates, int maxIterationsToLocateElements)DOMObjectValidatorvalidatePresentWithNonEmptyText(int maxIterationsToLocateElements)Validates whether the element is visible with non-empty text on screen.voidwaitForPageLoad()Methods inherited from class org.uitnet.testing.smartfwk.ui.core.objects.UIObjectValidator
getRegion, geUIObjectType, matchTextValue, performAction, seleniumToSikuliKeyConverter, sendCommandKeys, validateHidden, validateNotPresent, validateNotVisible, validatePresent, validateTextValue, validateVisible
-
Constructor Details
-
DOMObjectValidator
public DOMObjectValidator(SmartAppDriver appDriver, DOMObject domObject, org.sikuli.script.Region region)
-
-
Method Details
-
getUIObject
- Overrides:
getUIObjectin classUIObjectValidator
-
getAttributeValue
Returns the attribute value of the first element.- Parameters:
attributeName-maxIterationsToLocateElements-- Returns:
-
getAttributeValueWhenElementVisible
public String getAttributeValueWhenElementVisible(String attributeName, int maxIterationsToLocateElements)Finds attribute value from element when it is not hidden.- Parameters:
maxIterationsToLocateElements-
-
getAttributeValueWhenAttributeValueNonEmpty
public String getAttributeValueWhenAttributeValueNonEmpty(String attributeName, int maxIterationsToLocateElements)Finds attribute value from visible element when it's value is not empty. Leading and trailing whitespace will be removed in comparision.- Parameters:
maxIterationsToLocateElements-
-
findElement
public org.openqa.selenium.WebElement findElement(int maxIterationsToLocateElements)Finds first element with polling and it polls after 2 seconds for maxIterationsToLocateElements times.- Specified by:
findElementin classUIObjectValidator- Parameters:
maxIterationsToLocateElements-- Returns:
-
waitForPageLoad
public void waitForPageLoad() -
findElementNoException
public org.openqa.selenium.WebElement findElementNoException(int maxIterationsToLocateElements)Finds first element with polling and it polls after 2 seconds for maxIterationsToLocateElements times. It does not throw any exception- Specified by:
findElementNoExceptionin classUIObjectValidator- Parameters:
maxIterationsToLocateElements-- Returns:
-
findElements
This returns all the elements based on the locator. It waits for the configured timeout if the element is not present. Performs polling maxIterationsToLocateElements times.- Specified by:
findElementsin classUIObjectValidator- Parameters:
maxIterationsToLocateElements-- Returns:
-
scrollElementOnViewport
- Specified by:
scrollElementOnViewportin classUIObjectValidator
-
isPresent
public boolean isPresent(int maxIterationsToLocateElements)Return true only if first element is present but it might not be visible.- Specified by:
isPresentin classUIObjectValidator- Parameters:
maxIterationsToLocateElements-- Returns:
-
isVisible
public boolean isVisible(int maxIterationsToLocateElements)Return true only if element is visible.- Specified by:
isVisiblein classUIObjectValidator- Parameters:
maxIterationsToLocateElements-- Returns:
-
isReadonly
public boolean isReadonly(int maxIterationsToLocateElements) -
isDisabled
public boolean isDisabled(int maxIterationsToLocateElements) -
isDisabledButNotReadonly
public boolean isDisabledButNotReadonly(int maxIterationsToLocateElements) -
isSelected
public boolean isSelected(int maxIterationsToLocateElements)Determine whether or not this element is selected or not. This operation only applies to input elements such as checkboxes, options in a select and radio buttons.- Returns:
- True if the element is currently selected or checked, false otherwise.
-
getText
Finds text from element when element is present in HTML.- Parameters:
maxIterationsToLocateElements-
-
getTextWhenElementVisible
Finds text from element when it is not hidden.- Parameters:
maxIterationsToLocateElements-
-
getTextWhenElementValueNonEmpty
Finds text from visible element when it's value is not empty. Leading and trailing whitespace will be removed.- Parameters:
maxIterationsToLocateElements-
-
validatePresentWithNonEmptyText
Validates whether the element is visible with non-empty text on screen.- Parameters:
maxIterationsToLocateElements-
-
copyTextToClipboard
Copy text into clipboard from the current cursor position. Applicable only for editable fields i.e textbox, textarea etc. First it will click on that element and then select all text and copy into clipboard.- Returns:
-
pasteTextFromClipboard
Replace the content of the element with the clipboard contents. Applicable only for editable fields i.e textbox, textarea etc.- Returns:
-
click
- Specified by:
clickin classUIObjectValidator
-
forceClick
- Specified by:
forceClickin classUIObjectValidator
-
doubleClick
- Specified by:
doubleClickin classUIObjectValidator
-
rightClick
- Specified by:
rightClickin classUIObjectValidator
-
clickAndHold
- Specified by:
clickAndHoldin classUIObjectValidator
-
release
- Specified by:
releasein classUIObjectValidator
-
dragAndDrop
-
mouseHoverOver
- Specified by:
mouseHoverOverin classUIObjectValidator
-
performKeyDown
public DOMObjectValidator performKeyDown(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)- Specified by:
performKeyDownin classUIObjectValidator
-
performKeyUp
public DOMObjectValidator performKeyUp(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)- Specified by:
performKeyUpin classUIObjectValidator
-
performKeyPressed
public DOMObjectValidator performKeyPressed(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)- Specified by:
performKeyPressedin classUIObjectValidator
-
typeText
public DOMObjectValidator typeText(String text, NewTextLocation location, int maxIterationsToLocateElements)- Specified by:
typeTextin classUIObjectValidator
-
typeText
public DOMObjectValidator typeText(String text, NewTextLocation location, int typeSpeedInMspc, boolean clickBeforeType, int maxIterationsToLocateElements)Used to type the text on textbox and textarea componenets.- Parameters:
text- - text to typelocation- - location where to start typing.typeSpeedInMspc- - type speed in milliseconds per character.clickBeforeType- - should click before typing.maxIterationsToLocateElements- - max iteration to locate elements.- Returns:
-
sendKeys
-
getNewSeleniumActions
public org.openqa.selenium.interactions.Actions getNewSeleniumActions()- Specified by:
getNewSeleniumActionsin classUIObjectValidator
-
typeWithInterval
public void typeWithInterval(String textToType, int typeSpeedInMspc, org.openqa.selenium.WebElement webElem) -
validateElementPresentWithinArea
public DOMObjectValidator validateElementPresentWithinArea(AreaCoordinates coordinates, int maxIterationsToLocateElements)- Specified by:
validateElementPresentWithinAreain classUIObjectValidator
-