Overview
You are using Run keyword if incorrectly. You must give it a keyword as the first argument after the condition, not a variable reference. It will return whatever the keyword returns, which you can save in a variable.
In other words, instead of this (using pipe-separated values for clarity):
| | # incorrect
| | Run keyword if | <some condition> | ${variable}= | some keyword
... you need to do this:
| | # correct
| | ${variable}= | Run keyword if | <some condition> | some keyword
If the keyword is not run, the variable will be set to None
(ie: the same value that is in the automatic variable ${None}
)
Example using your code
In your case, you would replace the Run Keyword If
and Run Keyword Unless
statments with a single Run Keyword If
:
${rowAutoBidStatus}= Run Keyword If ${rowImageExist} Get Element Attribute jquery=tbody tr:eq(${rowIndex}) td:eq(${columnIndex}) img@data-status
If you really want the value to be ${Empty}
rather than ${None}
, starting with Robot Framework 2.7.4 you can add an ELSE
clause. It would look something like this (I'm going to spread it across multiple lines for clarity:
${rowAutoBidStatus}= Run Keyword If ${rowImageExist}
... Get Element Attribute jquery=tbody tr:eq(${rowIndex}) td:eq(${columnIndex}) img@data-status
... ELSE
... Set variable | ${Empty}