✔️VALIDATION
In the Scriptless Automation Framework, the VALIDATION field is essential for specifying the expected outcomes or values against which the state or properties of web elements are checked during automation tests. This field is effectively paired with VALIDATION_TYPE to enable various forms of validation checks.
Role of the VALIDATION Field
Purpose: The
VALIDATIONfield is used to define the expected result or benchmark for comparison during the validation of web elements.Versatility: Its usage varies depending on the chosen
VALIDATION_TYPE, catering to a wide range of validation scenarios.
Interaction with VALIDATION_TYPE
The VALIDATION_TYPE dictates how the VALIDATION field is employed:
EQUAL_IGNORE
Compares the web element's text with the value in VALIDATION, ignoring case differences.
Example:
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
SwagLabs,NONE,NONE,pageTitle,NONE,NONE,Swag Labs,EQUAL_IGNORETutorial:
IS_DISPLAY
This type does not utilize VALIDATION, focusing instead on the element's visibility.
Example:
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
SwagLabs,NONE,NONE,pageTitle,NONE,NONE,NONE,IS_DISPLAYTutorial:
IS_BUTTON_ENABLE / IS_BUTTON_DISABLE
These types do not use VALIDATION, assessing the enablement or disablement of a button element.
Example:
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
SwagLabs,NONE,NONE,loginButton,NONE,NONE,NONE,IS_BUTTON_ENABLE
SwagLabs,NONE,NONE,loginButton,NONE,NONE,NONE,IS_BUTTON_DISABLEATTRIBUTE_VALUE_PRESENT / ATTRIBUTE_VALUE_NOT_PRESENT
Here, VALIDATION specifies the attribute value to check for its presence or absence.
Example for ATTRIBUTE_VALUE_PRESENT:
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE SwagLabs,NONE,NONE,userName,NONE,Automation,NONE,NONE SwagLabs,NONE,NONE,userName,NONE,NONE,NONE,ATTRIBUTE_VALUE_PRESENTExample for ATTRIBUTE_VALUE_NOT_PRESENT:
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE SwagLabs,NONE,NONE,userName,NONE,NONE,NONE,ATTRIBUTE_VALUE_NOT_PRESENT
ATTRIBUTE_EQUAL_IGNORE
Compares an attribute's value against the VALIDATION field value, ignoring case. VALIDATION should follow the template attributeExpected|attributeProperty.
Example:
DEMO -> https://youtu.be/4YNpkKYCopI
ATTRIBUTE_EQUAL
Compares an attribute's value against the VALIDATION field value. VALIDATION should follow the template attributeExpected|attributeProperty.
Example:
ATTRIBUTE_CONTAINS
Ensures the attribute's value contains the substring provided in the VALIDATION field.VALIDATION should follow the template attributeExpected|attributeProperty.
Example:
CSS_PROPERTY
Added a feature for validating CSS property types, enabling users to ensure UI components match expected CSS values accurately. VALIDATION should follow the template "cssExpected | CssPropertyName".
Example: To validate the font-family of a page title in SwagLabs, the syntax would be:
Copy
PAGE_COMPARISON
Validate the screenshot taken from the driver against the expected screenshot stored in directory test_data/web/page_screenshot .
Example Scenarios
If
VALIDATION_TYPEisEQUAL_IGNOREandVALIDATIONis "Submit", the framework checks if the element’s text is "Submit", irrespective of case.For
IS_DISPLAY, theVALIDATIONfield is not necessary; the framework simply confirms the element's presence.
Last updated