verifyElementPresent in while loop


i have been trying to use verifyElementPresent to check if a specific
link exists.
the thing is that i have while loop and i list 10 pages.
some pages contain “link X” and some don’t.
during the while loop i do run verifyElementPresent to check if the
“link X” exist (so i can click it. otherwise just go to another page to check/click “link X”).
my goal is to click “link X” if it exists and to get to the next page
via pagination.
if it doesn’t exist its the same, go to the next page.
so basically i would go through 10 pages and on each page where the
“link X” is available i would do click and proceed to the next page.

the problem is that verifyElementPresent with if ${!statusOK} works only
on first page (first link)
on every other page verifyElementPresent simply does not detect “link X”.
it reports that “link X” is not found even if its there.

any thoughts ?


also i often get " [error]

timeout reached when looking for element", so it stops working.