I have a page that may and may not contain a certain element that will affect all the xpaths.
I need to run a "Run Keyword If" to identify if this element exists and if so to execute another keyword.
I tried to set the "Page Should Contain Element" and "Element Should Be Visible" as variables and pass it in the If statement but it only return None.
What can I use to identify an element in a page?
I experienced the same issue, I use this solution:
${present}= Run Keyword And Return Status Element Should Be Visible id=my-element
Run Keyword If ${present} My Cool Keyword
I had similar situation and I used the script below:
${IsElementVisible}= Run Keyword And Return Status Element Should Be Visible ${Element1}
Run Keyword If ${IsElementVisible} MyCase1 ELSE Click Element ${Element2}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With