Keywords for if else

If condition to check if username/password already exists or else press cancel button.
Program in robot framework

Hi

Simple If the username and password don't exist just press cancel
    IF  not ${username_password_exist}
        # press the cancel button
    END

Simple If the username and password don't exist just press cancel inline
    IF  not ${username_password_exist}          # press the cancel button

IF Expression do something on if exists else press cancel
    IF    ${username_password_exist}
        # do something...
    ELSE
        # press the cancel button
    END

You could also use the AND/OR operator, if let’s say the username and password are two separate variables forexample, there are other ways depending on you’re setup, and will provide some useful links.

Please also see that can be helpful
https://robotframework.org/code/?example=IF-Expression
That will allow you to see a working example and you can select custom and play around with your own statements without an IDE.

Some useful links to further understand whats available and visually see the syntax:
Builtin If Keywords
Robotframework IF/Else
IF Examples

1 Like