Is the else statement within the robot?

I am using the following keyword in the robot structure:

Welcome Page Should Be Open
    Run Keyword If    '${BROWSER}' == 'IE'    Location Should Be    ${LOGIN URL IE}
    Run Keyword If    '${BROWSER}' != 'IE'    Location Should Be    ${LOGIN URL}
    Wait Until Page Contains    Accounts    5s
    Page Should Contain    Accounts

      

Instead of having 2 Run Keyword If commands, I was wondering if the robot has an else statement that can be used, or or an OR operator that can be used?

Greetings

+3


source to share


1 answer


Since version 2.7.4 for the robot framework, you can use ELSE when calling the Run keyword if .

From the documentation :

Since Robot 2.7.4, this keyword also supports the optional ELSE and ELSE IF. Both are defined in * args and must use exactly the ELSE or ELSE IF format, respectively. Affiliates of ELSE must first provide the name of the keyword to execute, followed by its possible arguments. ELSE IF branches must first contain a condition, for example, the first argument for this keyword, and then the keyword to execute and its possible arguments. After ELSE, it is possible to have an ELSE IF branch and have multiple ELSE IF branches.



For example (for the sake of clarity, I am using the channel continuation format and functions):

| | Run Keyword If | '${BROWSER}' == 'IE'
| | ... | Location should be | ${LOGIN URL IE}
| | ... | ELSE 
| | ... | Location should be | ${LOGIN_URL}

      

+3


source







All Articles