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 voidclick(int maxIterationsToLocateElements)voidclickAndHold(int maxIterationsToLocateElements)voidcopyTextToClipboard(int maxIterationsToLocateElements)Copy text into clipboard from the current cursor position.voiddoubleClick(int maxIterationsToLocateElements)voiddragAndDrop(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.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.io.appium.java_client.MultiTouchActiongetNewMobileMultiTouchAction()io.appium.java_client.TouchActiongetNewMobileTouchAction()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.voidpasteTextFromClipboard(int maxIterationsToLocateElements)Replace the content of the element with the clipboard contents.voidperformKeyDown(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)voidperformKeyPressed(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)voidperformKeyUp(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)voidrelease(int maxIterationsToLocateElements)voidrightClick(int maxIterationsToLocateElements)DOMObjectValidatorscrollElementOnViewport(Scrollbar scrollbar)voidtypeText(String text, NewTextLocation location, int maxIterationsToLocateElements)voidvalidatePresentWithNonEmptyText(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, 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
public void validatePresentWithNonEmptyText(int maxIterationsToLocateElements)Validates whether the element is visible with non-empty text on screen.- Parameters:
maxIterationsToLocateElements-
-
copyTextToClipboard
public void copyTextToClipboard(int maxIterationsToLocateElements)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. -
pasteTextFromClipboard
public void pasteTextFromClipboard(int maxIterationsToLocateElements)Replace the content of the element with the clipboard contents. Applicable only for editable fields i.e textbox, textarea etc. -
click
public void click(int maxIterationsToLocateElements)- Specified by:
clickin classUIObjectValidator
-
doubleClick
public void doubleClick(int maxIterationsToLocateElements)- Specified by:
doubleClickin classUIObjectValidator
-
rightClick
public void rightClick(int maxIterationsToLocateElements)- Specified by:
rightClickin classUIObjectValidator
-
clickAndHold
public void clickAndHold(int maxIterationsToLocateElements)- Specified by:
clickAndHoldin classUIObjectValidator
-
release
public void release(int maxIterationsToLocateElements)- Specified by:
releasein classUIObjectValidator
-
dragAndDrop
-
performKeyDown
public void performKeyDown(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)- Specified by:
performKeyDownin classUIObjectValidator
-
performKeyUp
public void performKeyUp(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)- Specified by:
performKeyUpin classUIObjectValidator
-
performKeyPressed
public void performKeyPressed(org.openqa.selenium.Keys keys, int maxIterationsToLocateElements)- Specified by:
performKeyPressedin classUIObjectValidator
-
typeText
- Specified by:
typeTextin classUIObjectValidator
-
getNewMobileTouchAction
public io.appium.java_client.TouchAction getNewMobileTouchAction()- Specified by:
getNewMobileTouchActionin classUIObjectValidator
-
getNewMobileMultiTouchAction
public io.appium.java_client.MultiTouchAction getNewMobileMultiTouchAction()- Specified by:
getNewMobileMultiTouchActionin classUIObjectValidator
-
getNewSeleniumActions
public org.openqa.selenium.interactions.Actions getNewSeleniumActions()- Specified by:
getNewSeleniumActionsin classUIObjectValidator
-