I have to validate a page text after logging into an application, Text/ that page dont appear everytime but if the page appears then I have to do some actions and if it dont appear then I have to proceed.
I tried the below methods : 1.
Run Keyword If Page Should Contain ${txt_HomePage} Login Successful
Else Login Unsuccessful
Login Successful
Log Successfully logged into application
Login Unsucessful
Log Please verify userid and password
${Result}= Page Should Contain ${txt_HomePage}
Run Keyword Unless '${RESULT}'=='PASS' Log Unsucessfull
Both the cases are failing, any other suggestion? How to handles that objects that dont appear in all cases
Robot Framework is not very elegant when need to test a system that does not always behave same way. You can use RF Run Keyword And Ignore Error
to get pass/fail and work on that:
${status} ${message}= Run Keyword And Ignore Error Page Should Contain ${txt_HomePage}
IF "${status}" == "PASS"
Log Successfully logged into application
ELSE
Log Please verify userid and password
END