简体   繁体   中英

Multiple Conditions IF/ELSE statement Robot Framework 4

In RobotFramework 4 we can now write a more traditional looking if/else statement.

So something like:

*** Keywords ***
Do conditional execution
IF ${CONDITION}
Log True!
ELSE IF "cat" == "dog"
Log Dog!
ELSE
Log Not True!
END

Does anyone know how to write it with multiple conditions? Im currently working on something. If I write multiple statements like so, it works

        IF  "${error1}" == "False"
            Do Something

        ELSE IF  "${error2}" == "False"
            Do Something

        ELSE IF  "${error3}" == "False"
            Do Something

but if I try write it like this

IF  "${error1}" == "False"  or  "${error2}" == "False"  or  or  "${error3}" == "False"
   Write To Google Document

Then it tells me

IF has more than one condition.

Any ideas if I'm writing it wrong? Or is there a better way?

In your code you have two spaces before "or". You can't two or more spaces in your expression. You have "or or" in your expression.

This should work:

IF  "${error1}" == "False" or "${error2}" == "False" or "${error3}" == "False"
   Write To Google Document

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM