See:
Try Catch
Example:
Code: Select all
click:
driver.findElementByID("imgbtnLogin").click
try
{
Exists := driver.findElementByID("lblError").Attribute("innerText")
MSG_ERROR := InStr(Exists,"000")
if (MSG_ERROR > 0)
goto,click
}
catch
msgbox,done
return
If the lblError element exists you can probably just shorten the code to:
Code: Select all
click:
driver.findElementByID("imgbtnLogin").click
try
{
Exists := driver.findElementByID("lblError").Attribute("innerText")
goto,click
}
catch
msgbox,done
return
or
Code: Select all
click:
Loop
{
driver.findElementByID("imgbtnLogin").click
try
Exists := driver.findElementByID("lblError").Attribute("innerText")
catch
break
Sleep 500
}
return
HTH