For the complete documentation index, see llms.txt. This page is also available as Markdown.

Guide to writing Conditions

When using control blocks like If, Else if, or While, you need to set up a condition expression for the system to check at runtime. This expression will return a result of True (true) or False (false)

🎥 Watch the tutorial video: Here.

⚠️ Core rule about Strings: For data types that are text/string, you must wrap them in double quotes "" (Example: $name = "admin"). For numbers, just enter them directly.

1. Arithmetic Comparison Operators (Only applicable to Numbers)

  • > : Greater than. (Example: $count > 5)

  • < : Less than. (Example: $loopIndex < 10)

  • >= : Greater than or equal to.

  • <= : Less than or equal to.

2. Logical Comparison Operators (Applicable to both Numbers and Strings)

  • = : Equal.

    • Example: 3 = 3 ➡️ true

    • Example: "hello" = "hola" ➡️ false

  • != : Not equal (Negation of equality).

    • Example: 3 != 4 ➡️ true

    • Example: "hello" != "hello" ➡️ false

3. String Processing Operators

  • contains : Checks if the preceding string contains the following string.

    • Example: "ABCD" contains "AB" ➡️ true

    • Example: "AB" contains "ABCD" ➡️ false

  • !contains : Checks if the preceding string does NOT contain the following string.

    • Example: !"ABCD" contains "AB" ➡️ false

    • Example: !"AB" contains "ABCD" ➡️ true

  • contains "B" (When standing alone before B): Checks if the variable or string in question is an empty string or not.

    • Result: Returns true if empty, and false if it contains data.

4. Function to Check Elements on the Interface (Element)

This function helps the script recognize the presence of buttons, input fields, etc., on the webpage through the XPath path:

  • hasElement(XPATH) : Condition is true when the element exists on the page.

  • !hasElement(XPATH) : Condition is true when the element does not exist on the page (Negation of hasElement).

5. How to Combine Multiple Complex Conditions

You can combine multiple conditions together in one line by using logical symbols and parentheses () to group:

  • && : AND (All conditions must be true simultaneously).

  • || : OR (Only one of the conditions needs to be true).

Practical examples when writing conditions:

  • Case 1: Check if the number of iterations is greater than 5 and the account name contains the letters "abc":

  • Case 2: Check if the Login button does not appear (logged in) OR the error variable is displaying the text "true":

Last updated

Was this helpful?