Robotframework: Keep on refreshing browser page until page contains the element

With Robot Framework and Selenium, I want to create a keyword to keep on refreshing the page until page contains the element.
I do not think I can use Wait Until Page Contains Element <xpath> <time> because the page needs to be refreshed to show the element. How can I write a FOR Loop to do this?

*** Keywords *** Refresh Page until page contains the element Reload Page Page Should Contain Element <xpath> 

Or may be I can somehow loop this?

${Reload}= Run Keyword And Return Status Page Should Contain Element <xpath> Run Keyword If ${Reload} <don't know how to write here> ELSE Reload Page 

1 Answer

Hi this could be achieved by using something similar to the below snippet. Using a while loop which has additional examples here: RoboCorp WHILE Loops

Refresh Page Until Page Contains Element ${Reload}= Run Keyword And Return Status Page Should Contain Element <xpath> WHILE ${Reload} != ${TRUE} ${Reload}= Run Keyword And Return Status Page Should Contain Element <xpath> END

Hope this helps

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like