verifyElementPresent not functioning in while; works fine executed individually

Weird thing happening here, both in FF and Chrome. v3.6.7. Within a while command, Kantu checks to see if an element exists; if it does, it moves on; if not, it reloads the page. Depending on how cranky it is, it loops five or six times, then gets stuck reloading because it can’t verify the target id exists. I’ve sat there and watched it, and the id is there. I’ve stopped the macro and verified it exists - and yet it still shows false for !StatusOK. I even stopped it while the id was present, then triggered the verifyElementPresent command manually - and it showed true for !StatusOK. Do i need to increase my !timeout_wait? (currently at 3s)
{
“Command”: “store”,
“Target”: “3”,
“Value”: “!timeout_wait”
},
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!errorIgnore”
},
{
“Command”: “verifyElementPresent”,
“Target”: “id=herpderp”,
“Value”: “”
},
{
“Command”: “store”,
“Target”: “false”,
“Value”: “!errorIgnore”
},
{
“Command”: “gotoIf”,
“Target”: “!${!StatusOK}”,
“Value”: “reload_error”
},

I can not recreate the issue. Here is a test macro that runs in a loop, and it works fine. Does it work for you, too?

{
  "Name": "_verifyElementPresent",
  "CreationDate": "2019-1-4",
  "Commands": [
    {
      "Command": "store",
      "Target": "2",
      "Value": "!timeout_wait"
    },
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed"
    },
    {
      "Command": "selectWindow",
      "Target": "tab=open",
      "Value": "https://yuilibrary.com/yui/docs/node/node-insert.html"
    },
    {
      "Command": "label",
      "Target": "tryagain",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!statusOK"
    },
    {
      "Command": "verifyElementPresent",
      "Target": "xpath=//img[@alt='Lettuce']",
      "Value": ""
    },
    {
      "Command": "gotoIf",
      "Target": "${!statusOK} == false",
      "Value": "tryagain"
    },
    {
      "Command": "echo",
      "Target": "element found!",
      "Value": "green"
    }
  ]
}

With this function, is possible to try to solve like geetest captcha ? I mean I have see just a few images to do slide so I am try to pick up that images how I can put in the script to if see image1 do this or if see image2 do that ? (sorry may be a noob question but I am still learning a little)

I was forced to store true in !statusOK variable each time before using verifyElementPresent command, only then it works fine.

2 Likes

This was required for me as well UI.Vision RPA 8.0.1