I am new to Robot Framework and I am trying to use Run Keyword If .. ELSE ..
.
What it should do:
Add a new keyword to perform a check if a page includes the word "closed". If it does, refresh the page. If it doesn't, click element "this" and proceed with the rest of the scenario.
*** Keywords ***
Check if anything is closed
${ClickThis} Click Element xpath=//*[@id="this"]
${Closed} Page Should Contain Element xpath=//*[text()='Closed']
Run Keyword If ${Closed} =='PASS' Reload Page ELSE ${ClickThis}
What happens when I run it:
"Closed" does not appear in the page. "this" is clicked. Then the test fails because:Page should have contained element 'xpath=//*[text()='Closed']' but did not
Please, help me in correcting it.
Edit: changed Page Should Contain
to Page Should Contain Element
. Same results.