verifyElementPresent For 5 Times only How do?

@ulrich @Timo @thecoder2012 @Plankton

I need a solution to verifyElementPresent for 5 times only, after the macro must continue with another command.

I write a code with verifyElementPresent forever but i need to limite it to 5 times and after i need to refresh the page (to prevent partial loading of page)

This is the code, but in case the page do not load it remain forever to check, i need to limite this checking to 5 times and after refresh the page.

{
“Command”: “echo”,
“Target”: “Check Loaded Email”,
“Value”: “”
},
{
“Command”: “label”,
“Target”: “Check_Again”,
“Value”: “”
},
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!statusOK”
},
{
“Command”: “verifyElementPresent”,
“Target”: “xpath=//*[@id=“window-0”]/div/div[4]/div/ol/li[1]/div/div[1]/button”,
“Value”: “”
},
{
“Command”: “gotoIf_v2”,
“Target”: “${!statusOK} == false”,
“Value”: “Check_Again”
},
{
“Command”: “echo”,
“Target”: “Email Has Been Loaded”,
“Value”: “#shownotification
}

This is the code, but in case the page do not load it remain forever to check,

Why forever? verifyElementPresent should only check until !timeout_wait time is reached, or?

Remail forever to check because there is this gotoIf_v2

{
“Command”: “gotoIf_v2”,
“Target”: “${!statusOK} == false”,
“Value”: “Check_Again”
},

I need to check some times, not forever

Ok, but then I don’t understand what part of your macro does not work?

If you only want to check five times, and add a variable “counter” and increase it +1 at each loop.

{
  "Command": "executeScript",
  "Target": "return ${counter} + 1;",
  "Value": "counter"
},
1 Like

Thanks for your suggestion

I think to use if with condition of counter = 5

This macro check an element after login, after login the site load 30 seconds, if do not appears the page it’s recheck 5 times, after 5 times where the element not found i add a refresh of the page (probably page not load correct)

I search a good solution to manage the not load page cases.

If a page not load or load partial what is the best solution to bypass this case ?