Robot framework keyword run keyword if application

Time:2022-5-20

In RF, we will use the keyword run keyword if when using condition judgment. Here is a brief summary of some applications in the automation process

1、 Common grammar

1) Run keyword if # judge expression # keyword # parameter

2) Run keyword if # judgment expression # keyword # parameter # else keyword # parameter

3) Run keyword if # judge expression # keyword # parameter

… Else if # judgment expression # keyword # parameter

… Else if # judgment expression # keyword # parameter

… Else # keyword # parameter

4) ${variable} run keyword if judgment expression set variable / evaluate parameter / expression

2、 Daily application

Application 1:

When the expression holds, execute a keyword.

Application 2:

Assignment: when the expression is valid, execute the expression after the evaluate keyword and output the result ${B} = 1

Assignment: when the expression is valid, execute the set variable keyword and assign it to 1; if not, execute the keyword set variable and assign it to 2, and the output result is ${B} = 1

Application 3:

Multiple judgment conditions

Special note:

1. Expressions can also use in / or / and, andMust be lowercase

2、ELSE/ELSE IFMust be uppercase