I'm struggling to create a test case in robotframework using Selenium. Basically my goal is capture some web elements in FOR loop using some xpath query, checking the actual web elements exist on the page, in case doesn't pass next. I've created following script:
*** Test Cases ***
FOR ${href} IN @{hrefs}
Log ${href}
${pl}= Run Keyword And Continue On Failure Get Element Count xpath://a[contains(@href,'test')]
${photo_link}= Run Keyword If ${pl}> 0 Get WebElement xpath://a[contains(@href,'test')]
${test_a}= Set Variable ${photo_link.get_attribute('innerHTML')}
ELSE
${test_a}= do something else
END
Close All Browsers
But I always get error:
'Else' is a reserved keyword. It must be in uppercase (ELSE) when used as a marker with 'Run Keyword If'.
Checking documentation I was not able to find any solution. Am I using wrong syntax? Is there some alternative way to avoid and skip "Get WebElements" without match? Thank you