Log in loop, error in repeatif Complete newbie!

Complete newbie here! I am trying to automate a website log in. Log in to the website only opens at set time each day. so I want to run the macro at that time. Each log in attempt may fail (due to multiple users at same time, delay in actual opening of the website). I need the macro to repeatedly atempt the log in if the previous one failed (my test for this is a screen shot of the “website down” message. Once the initial log in page is passed, a verify credentials page open up. The error I am getting is a “error in condition of repeatif: $is not defined”, . I attach a screen sot of the macro record/entered, and the code is below. Many TIA!
{
“Name”: “jpgtest”,
“CreationDate”: “2024-2-20”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://mybond.hpb.co.uk/Login/”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “do”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “id=LogIn”,
“Value”: “”,
“Targets”: [
“id=LogIn”,
“name=ctl00$LogIn”,
“xpath=//[@id="LogIn"]",
“xpath=//input[@id=‘LogIn’]”,
“xpath=//div/div/input[2]”,
“css=#LogIn”
],
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “500”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “visualVerify”,
“Target”: “hpbsitedown_dpi_96.png”,
“Value”: “found”,
“Description”: “”
},
{
“Command”: “repeatIf”,
“Target”: “$(found) == 0”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “2000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “id=ContentPlaceHolder1_Login”,
“Value”: “”,
“Targets”: [
“id=ContentPlaceHolder1_Login”,
“name=ctl00$ContentPlaceHolder1$Login”,
"xpath=//
[@id="ContentPlaceHolder1_Login"]”,
“xpath=//input[@id=‘ContentPlaceHolder1_Login’]”,
“xpath=//div/div[2]/input[2]”,
“css=#ContentPlaceHolder1_Login”
],
“Description”: “”
}
]
}

Line 5 is the issue.

visualAssert (like all verify… and assert… Selenium IDE commands) does not store the result in a variable.Instead it sets the !statusOK internal variable.

So the solution is:

  • store | 0 | !timeout_wait Optional: Dont wait for 10 seconds for the element to show up. Waiting is not needed when running in loop anyway.

  • store | true | !statusOK Reset !statusOK to true in case it was set to false (by an error) somewhere else in the code already.

  • visualVerify | hpbsitedown_dpi_96.png

  • repeatIf | $(!statusOK) == false - now your check will work :slight_smile:

1 Like