Hasib,This is by design. Basically we don’t fail the step if there is nothing found because it’s not a failure. It can be used for cases where users wants to act on an element not be present. In short, the user may want to do IF (data doesn’t exist) Then do ….. It’s similar to SQL, where your query returns null but doesn’t fail. As an alternative method, you can use:
1. get_web_value
2. if (value doesn’t exist)
3. assert failure
4. get_web_value
5. if (value exists)
6. do (action)
Variable of "GET_WEB_VALUE" is set to null when the locator doesn't exist. However, it should fail with "Locator not found" message
When "GET_WEB_VALUE" command is used and the element is not found, the variable is set to BLANK. However the step should be failed so when looking in the results, we know which step is exactly the issue. Otherwise the failure will be some where else when "Compare" step is used.
I know we can use the "VERIFY_ELEMENT" command before the "GET_WEB_VALUE" if the verification of the element existing is done part of GET_WEB_VALUE, it's more efficient.
Hi William,
This variable can be used for non existing values: @system.empty
Example:
WEB VALUE_GET RESULT_VARIABLE value SOURCE JAVA_SCRIPT "const value = 'test'\nconsole.log(value)\n// return value" HALT ON ERROR
IF @value EQUAL @system.empty AS TEXT
WRITE TEXT "Value is empty" OUTPUT CONSOLE HALT ON ERROR
IF_END
Regards,
Subject7 Team
Please sign in to leave a comment.