I'm having issue in negate the bool variable or comparison of FALSE against a bool variable to perform Run Keyword If
My Code is
Test Case
${isExist}= Run Keyword And Return Status Element Should Be Visible ${element_Id}
Run Keyword If ${isExist} == false click element ${cancelbtn}
Here I'm facing an Run time error
Evaluating expression 'True and' failed: SyntaxError: unexpected EOF while parsing (, line 1)
I tried the following comparison too
${isExist} == 'false' '${isExist}' == 'false' ${isExist} == ${false} '${isExist}' == '${false}' !${isExist}Note: log to console ${isExist} - It logs the appropriate Boolean value in the console window.
if ${isExist} is a boolean, you can use not
Run Keyword If not ${isExist} ...
You can also compare to ${FALSE} or ${TRUE}:
Run Keyword If ${isExist} is ${FALSE} ...
Run Keyword If ${isExist} is not ${TRUE} ...
You say that ${isExist} == ${false} doesn't work, but it will if {isExist} is indeed the boolean value False.
Note: ${FALSE} and ${TRUE} are variables defined by robot. They are briefly mentioned in the documentation in the section titled Boolean and None/null variables in the robot framework user guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With