Hey,
I am new to Kantu. I am trying to build a macro that does:
- go to mysite.com
- 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)
- 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)
- site does a ajax call and loads more content in same page
- so i need to go and click in the first ocurrence of “//*[contains(@class, ‘btn btn-mobile btn-success btn-sm pull-right’)]”
- after this, site load more content in same page via another ajax call.
- so I need to check if this string “Suas curtidas foram entregues, atualize a página.” that is contained in “string” has been shown
- 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.