WHILE loops in Robot Framework

1,320 views
Skip to first unread message

Vladislav Golban

unread,
Dec 30, 2022, 12:24:03 PM12/30/22
to robotframework-users
Hi, I'm exhausted from searching for info about WHILE loops in the Robot Framework, I need to create a loop that will click on the Next Page button until a specific locator is found by Robot.
Any information or resource that can teach me how to create such loops will be extremely beneficial.

Thanks and Happy New Year!!

Craig Despeaux

unread,
Jan 2, 2023, 7:55:44 AM1/2/23
to robotframework-users
Should be able to do something along the lines of this:

${locator_found} = ${False}
WHILE  ${locator_found} == ${False}
  keyword to click next page
  ${locator_found} =  keyword that returns true or false indicating whether locator was found
END

You may also want to keep track of a max loop count and fail if you reach it without finding the locator.

Hope that helps!

Craig

asha saxena

unread,
Jan 2, 2023, 8:09:07 AM1/2/23
to craiged...@gmail.com, robotframework-users
Better option is 
Wait until element is visible / wait until page contains element 

This will be defined with timeout in seconds /minute 
Wait until page contains element.      $locator.     1h 5m 30s.   msg=Failure message

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/799c6020-d24d-48d1-90c9-86509f76e29bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages