Is there any option in Robot framework to set the value of a variable "TRUE" or "FALSE" depending upon a condition ?
I want to run a keyword only if a condition is TRUE, i.e. a keyword should run only if a particular ID exists in present screen.
Here is my test script -
*** Settings ***
Library Selenium2Library
Test Setup Open Browser http://xyz.com chrome
Test Teardown Close All Browsers
*** Variables ***
${IdExist} None
*** Test Cases ***
Test1
Open Application and check page content
*** Keywords ***
Open application and check page content
Maximize Browser Window
Sleep 2s
Click Element id=Start
Sleep 2s
${IdExist} = Page Should Contain Element id=hamburger-icon
Run Keyword if "${IdExist}" == "PASS" Click Button
Click Button
Click Element id=hamburger-icon
Is this a Correct way of writing a test script to set the value for a variable?
${IdExist} = Page Should Contain Element id=hamburger-icon
I found this particular piece of code in a website !
But, while running the above test case, the value of the variable is not getting set as TRUE / PASS value, even though the particular icon exists in present screen (The keyword Click Button
is not at all triggering!)
Is there any other effective way to handle this particular scenario?
Am I missing something? Please help me to solve this issue.