Class UiConditions
- Samples
$("input").shouldBe(VISIBLE);$("#logoutLink").should(APPEAR);$.shouldNot(exist);
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.workfusion.rpa.helpers.conditionsnative.UiConditionSynonym forVISIBLE- may be used for better readability Sample$("#logoutLink").should(APPEAR);static final com.workfusion.rpa.helpers.conditionsnative.UiConditionSynonym forVISIBLE- may be used for better readabilitystatic final com.workfusion.rpa.helpers.conditionsnative.UiConditionChecks that element is disabledstatic final com.workfusion.rpa.helpers.conditionsnative.UiConditionSynonym forHIDDEN- may be used for better readability:static final com.workfusion.rpa.helpers.conditionsnative.UiConditionSynonym forHIDDEN- may be used for better readability:static final com.workfusion.rpa.helpers.conditionsnative.UiCondition1) For input element, checks that value is missing or emptystatic final com.workfusion.rpa.helpers.conditionsnative.UiConditionChecks that element is not disabledstatic final com.workfusion.rpa.helpers.conditionsnative.UiConditionCheck that element exists.static final com.workfusion.rpa.helpers.conditionsnative.UiConditionCheck if browser focus is currently on a given element.static final com.workfusion.rpa.helpers.conditionsnative.UiConditionChecks that element is not visible or does not exists.static final com.workfusion.rpa.helpers.conditionsnative.UiConditionChecks that element is present on the page.static final com.workfusion.rpa.helpers.conditionsnative.UiConditionCheck if element has "readonly" attribute (with any value)static final com.workfusion.rpa.helpers.conditionsnative.UiConditionChecks that element is selectedstatic final com.workfusion.rpa.helpers.conditionsnative.UiConditionChecks that element is visible Sample$("input").shouldBe(VISIBLE); -
Method Summary
Modifier and TypeMethodDescriptionstatic com.workfusion.rpa.helpers.conditionsnative.UiConditionCheck if element matches ALL given conditions.static com.workfusion.rpa.helpers.conditionsnative.UiConditionChecks that element has a given attribute (with any value)static com.workfusion.rpa.helpers.conditionsnative.UiConditionChecks that current element has an attribute with specified valuestatic com.workfusion.rpa.helpers.conditionsnative.UiConditionbe(com.workfusion.rpa.helpers.conditionsnative.UiCondition delegate) Used to form human-readable condition expression Example element.should(be(VISIBLE),have(text("abc"))static com.workfusion.rpa.helpers.conditionsnative.UiConditionSample:$("input").shouldHave(cssClass("active"));static com.workfusion.rpa.helpers.conditionsnative.UiConditionhasAttribute(String attributeName, String attributeValue) Checks that current element has an attribute with specified valuestatic com.workfusion.rpa.helpers.conditionsnative.UiConditionSample:$("input").waitUntil(hasClass("blocked"), 7000);static com.workfusion.rpa.helpers.conditionsnative.UiConditionhasPartialValue(String expectedPartOfValue) Synonym forpartialValue(String)static com.workfusion.rpa.helpers.conditionsnative.UiConditionAsserts that element has specified text contentstatic com.workfusion.rpa.helpers.conditionsnative.UiConditionSynonym forvalue(String)static com.workfusion.rpa.helpers.conditionsnative.UiConditionhave(com.workfusion.rpa.helpers.conditionsnative.UiCondition delegate) Used to form human-readable condition expression Example element.should(be(VISIBLE),have(text("abc"))static com.workfusion.rpa.helpers.conditionsnative.UiConditionAsserts that element has given "id" attribute as substringstatic com.workfusion.rpa.helpers.conditionsnative.UiConditionmatchRegexp(String regex) Assert that given element's text matches given regular expressionstatic com.workfusion.rpa.helpers.conditionsnative.UiConditionAsserts that element has given "name" attribute as substringstatic com.workfusion.rpa.helpers.conditionsnative.UiConditionnot(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Negate given condition.static com.workfusion.rpa.helpers.conditionsnative.UiConditionCheck if element matches ANY of given conditions.static com.workfusion.rpa.helpers.conditionsnative.UiConditionpartialValue(String expectedPartOfValue) Asserts that element has given "value" attribute as substringstatic com.workfusion.rpa.helpers.conditionsnative.UiConditionAsserts that element has specified text contentstatic com.workfusion.rpa.helpers.conditionsnative.UiConditiontextCaseInSensitive(String text) Asserts that element has specified text contentstatic com.workfusion.rpa.helpers.conditionsnative.UiConditionAsserts that element has given "type" attribute as substringstatic com.workfusion.rpa.helpers.conditionsnative.UiConditionAsserts that element has given "value" attribute as substring
-
Field Details
-
ENABLED
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition ENABLEDChecks that element is not disabled- See Also:
-
DISABLED
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition DISABLEDChecks that element is disabled- See Also:
-
VISIBLE
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition VISIBLEChecks that element is visible- Sample
$("input").shouldBe(VISIBLE);
- See Also:
-
EXIST
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition EXISTCheck that element exists. It can be visible or hidden.- Sample
$("input").should(EXIST);
-
PRESENT
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition PRESENTChecks that element is present on the page. Synonym forEXIST.- Sample
$("input").shouldBe(PRESENT);
-
HIDDEN
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition HIDDENChecks that element is not visible or does not exists. Opposite toAPPEAR- Sample
$("input").shouldBe(HIDDEN);
-
APPEAR
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition APPEARSynonym forVISIBLE- may be used for better readability- Sample
$("#logoutLink").should(APPEAR);
-
APPEARS
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition APPEARSSynonym forVISIBLE- may be used for better readability$("#logoutLink").waitUntil(APPEARS, 10000); -
DISAPPEARS
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition DISAPPEARSSynonym forHIDDEN- may be used for better readability:Sample:
$("#loginLink").waitUntil(DISAPPEARS, 9000); -
DISAPPEAR
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition DISAPPEARSynonym forHIDDEN- may be used for better readability:$("#loginLink").should(DISAPPEAR); -
READONLY
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition READONLYCheck if element has "readonly" attribute (with any value)Sample:
$("input").shouldBe(readonly); -
FOCUSED
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition FOCUSEDCheck if browser focus is currently on a given element. -
SELECTED
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition SELECTEDChecks that element is selected- See Also:
-
EMPTY_ELEMENT
public static final com.workfusion.rpa.helpers.conditionsnative.UiCondition EMPTY_ELEMENT1) For input element, checks that value is missing or emptySample:
2) For other elements, checks that text is empty$("#input").shouldBe(EMPTY_ELEMENT)Sample:
$("h2").shouldBe(EMPTY_ELEMENT)
-
-
Method Details
-
hasAttribute
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition hasAttribute(String attributeName, String attributeValue) Checks that current element has an attribute with specified valueSample:
$("#mydiv").waitUntil(hasAttribute("fileId", "12345"), 7000);- Parameters:
attributeName- name of attributeattributeValue- expected value of attribute- Returns:
- true if attribute with the specified value exists
-
attribute
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition attribute(String attributeName) Checks that element has a given attribute (with any value)Sample:
$("#mydiv").shouldHave(attribute("fileId"));- Parameters:
attributeName- name of attribute, not null- Returns:
- true if attribute exists
-
attribute
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition attribute(String attributeName, String expectedAttributeValue) Checks that current element has an attribute with specified valueSample:
$("#mydiv").shouldHave(attribute("fileId", "12345"));- Parameters:
attributeName- name of attributeexpectedAttributeValue- expected value of attribute- Returns:
- true if attribute with the specified value exists
-
partialValue
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition partialValue(String expectedPartOfValue) Asserts that element has given "value" attribute as substringNB! Ignores difference in non-visible characters like spaces, non-breakable spaces, tabs, newlines etc.
Sample:
$("input").shouldHave(partialValue("12345 666 77"));- Parameters:
expectedPartOfValue- expected part of value of "value" attribute
-
hasPartialValue
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition hasPartialValue(String expectedPartOfValue) Synonym forpartialValue(String)NB! Ignores difference in non-visible characters like spaces, non-breakable spaces, tabs, newlines etc.
Sample:
$("#myInput").waitUntil(hasPartialValue("John"), 5000)- Parameters:
expectedPartOfValue- expected part of value of "value" attribute
-
value
Asserts that element has given "value" attribute as substringNB! Value must exactly match the string, including characters like spaces, non-breakable spaces, tabs, newlines etc.
Sample:
$("#input").shouldHave(exactValue("John"));- Parameters:
expectedValue- expected value of "value" attribute
-
hasValue
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition hasValue(String expectedValue) Synonym forvalue(String)Sample:
$("#myInput").waitUntil(hasValue("John"), 5000)- Parameters:
expectedValue- expected part of value of "value" attribute
-
name
Asserts that element has given "name" attribute as substringSample:
$("#input").shouldHave(name("username"))- Parameters:
name- expected name of input field
-
type
Asserts that element has given "type" attribute as substringSample:
$("#input").shouldHave(type("checkbox"))- Parameters:
type- expected type of input field
-
id
Asserts that element has given "id" attribute as substringSample:
$("#input").shouldHave(id("myForm"))- Parameters:
id- expected id of input field
-
hasText
Asserts that element has specified text contentSample:
$("h1").waitUntil(hasText("Hello"), 10000)Case sensitive
- Parameters:
text- expected text of Ui element
-
text
Asserts that element has specified text contentSample:
$("h1").shouldHave(text("Hello\s*John"))Case sensitive
- Parameters:
text- expected text of Ui element
-
textCaseInSensitive
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition textCaseInSensitive(String text) Asserts that element has specified text contentSample:
$("h1").shouldHave(textCaseInSensitive("Hello\s*John"))Case insensitive
- Parameters:
text- expected text of HTML element
-
matchRegexp
Assert that given element's text matches given regular expressionSample:
$("h1").should(matchText("Hello\s*John"))- Parameters:
regex- e.g. Kicked.*Chuck Norris - in this case ".*" can contain any characters including spaces, tabs, CR etc.
-
hasClass
Sample:
$("input").waitUntil(hasClass("blocked"), 7000); -
cssClass
Sample:
$("input").shouldHave(cssClass("active")); -
not
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition not(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Negate given condition. Used for methods like $.shouldNot(exist), $.shouldNotBe(VISIBLE) Typically you don't need to use it. -
and
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition and(String name, com.workfusion.rpa.helpers.conditionsnative.UiCondition... conditions) Check if element matches ALL given conditions.- Parameters:
name- Name of this condition, like "empty" (meaning e.g. empty text AND empty value).conditions- Conditions to match.- Returns:
- logical AND for given conditions.
-
or
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition or(String name, com.workfusion.rpa.helpers.conditionsnative.UiCondition... conditions) Check if element matches ANY of given conditions.- Parameters:
name- Name of this condition, like "error" (meaning e.g. "error" OR "failed").conditions- Conditions to match.- Returns:
- logical OR for given conditions.
-
be
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition be(com.workfusion.rpa.helpers.conditionsnative.UiCondition delegate) Used to form human-readable condition expression Example element.should(be(VISIBLE),have(text("abc"))- Parameters:
delegate- next condition to wrapp- Returns:
- Condition
-
have
public static com.workfusion.rpa.helpers.conditionsnative.UiCondition have(com.workfusion.rpa.helpers.conditionsnative.UiCondition delegate) Used to form human-readable condition expression Example element.should(be(VISIBLE),have(text("abc"))- Parameters:
delegate- next condition to wrapp- Returns:
- Condition
-