Issue with item values true/false and loops

Hey,

I am new to Kantu. I am trying to build a macro that does:

  1. go to mysite.com
  2. there is a button that has a timer, it gets enabled every 10 minutes and then get “disabled” (an attribute “disabled” is added to its html)
  3. so I need to check if button with id=getlikes is not disabled then click on it (if it is disabled, it must keep checking until it the attribute disabled get removed)
  4. site does a ajax call and loads more content in same page
  5. so i need to go and click in the first ocurrence of “//*[contains(@class, ‘btn btn-mobile btn-success btn-sm pull-right’)]”
  6. after this, site load more content in same page via another ajax call.
  7. so I need to check if this string “Suas curtidas foram entregues, atualize a página.” that is contained in “
    string
    ” has been shown
  8. wait 600s (10 minutes)
    go back to 1 step.

I am having issues with the loop to check if button is disabled or not (2-3) and the one to check if string has been shown (6)

{
  "CreationDate": "2018-10-31",
  "Commands": [
    {
      "Command": "open",
      "Target": "mysite dot com",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "document.getElementById('getlikes').disabled",
      "Value": "botaoDesativado"
    },
    {
      "Command": "while",
      "Target": "${botaoDesativado}",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "button not active yet, wait 2 seconds and try again",
      "Value": ""
    },
    {
      "Command": "pause",
      "Target": "2000",
      "Value": ""
    },
    {
      "Command": "endWhile",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=getlikes",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "10",
      "Value": "!TIMEOUT_WAIT"
    },
    {
      "Command": "click",
      "Target": "//*[contains(@class, 'btn btn-mobile btn-success btn-sm pull-right')]",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!errorignore"
    },
    {
      "Command": "while",
      "Target": "${!statusOK",
      "Value": ""
    },
    {
      "Command": "waitForVisible",
      "Target": "document.getElementsByClassName('panel-warning')",
      "Value": ""
    },
    {
      "Command": "endWhile",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "false",
      "Value": "!errorignore"
    },
    {
      "Command": "open",
      "Target": "mysite dot com",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "660",
      "Value": "!TIMEOUT_WAIT"
    }
  ]
}

ps. had to change “http://mysite.com” to “mysite dot com” in the code above because I cant post more than 2 links.

Any idea or help?

Thanks in advance.

Can you include a link to the website? It is impossible to solve these issues without a link to the website. But maybe a general hint to make the automation easier:

  • Instead of looking at the DOM level, you can also look at the image of buttons etc with commands like visualAssert.

  • Use XClick for clicks… it avoids all Javascript issues

Hey, thanks for your reply! It wont work as site is private and paid to access… so you guys wouldnt be able to check it :\

But i sorted it out in a completely different way! Thank you.