[Issue #513] Pausing (stopping) Issue

Moving discussion to new post. So here’s some code I run and it pauses pretty frequently on me. It won’t stop every time I run it but probably 40-50% of the time it will pause on me. And my wording maybe caused some confusion, my issue isn’t with the “pause” command. My macro will just stop in random spots (not after a “pause” command). It will stop and it just sits there without erroring out until i either hit “stop” to cancel or “resume”. Hitting “resume” will normally start back up again just fine. Like just now it stopped on this random line of code

{
“CreationDate”: “2018-10-5”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://www.amazon.com/report/infringement”,
“Value”: “”
},
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!errorIgnore”
},
{
“Command”: “store”,
“Target”: “51”,
“Value”: “z”
},
{
“Command”: “label”,
“Target”: “restart”,
“Value”: “”
},
{
“Command”: “csvRead”,
“Target”: “KantuEnforcements.csv”,
“Value”: “”
},
{
“Command”: “store”,
“Target”: “{!csvReadLineNumber}", "Value": "!csvReadLineNumber" }, { "Command": "store", "Target": "{!csvReadMaxRow}”,
“Value”: “rows”
},
{
“Command”: “while”,
“Target”: “{!csvReadLineNumber}<{z}”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=inputASIN”,
“Value”: “{!COL1}" }, { "Command": "store", "Target": "{!COL1}”,
“Value”: “a”
},
{
“Command”: “click”,
“Target”: “id=inputGoButton”,
“Value”: “”
},
{
“Command”: “select”,
“Target”: “id=inputInfringingElement-{A}", "Value": "label=ASIN/ISBN-10" }, { "Command": "storeEval", "Target": "{!csvReadLineNumber}+1”,
“Value”: “!csvReadLineNumber”
},
{
“Command”: “csvRead”,
“Target”: “Kantu.csv”,
“Value”: “”
},
{
“Command”: “endWhile”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “if”,
“Target”: “{!csvReadMaxRow} > {!csvReadLineNumber}”,
“Value”: “”
},
{
“Command”: “storeEval”,
“Target”: “${z}+50”,
“Value”: “z”
},
{
“Command”: “selectWindow”,
“Target”: “tab=open”,
“Value”: “https://www.amazon.com/report/infringement
},
{
“Command”: “gotoLabel”,
“Target”: “restart”,
“Value”: “”
},
{
“Command”: “endif”,
“Target”: “”,
“Value”: “”
}
]
}

I don’t have an answer to your question BUT it has been my experience that if a site, especially a site like Amazon, gets a set of fast hits from an IP they will block or throttle that IP… I try to insert a random pause in my scripts (Kantu may or may not support same) to fool the server into thinking there is a human behind the requests… maybe what you are seeing is amazon throttling your IP until it figures out if you are a robot…?

I run a 563 step script every night as I sleep. It was not uncommon for my script to randomly stop and eventually stop because I was sleeping and unable to interact. I added

{
  "Command": "store",
  "Target": "!replayspeed",
  "Value": "slow"
},

to the start of my script. This helped a lot but did not completely resolve the stopping issue. I then started documenting what line of the script caused the pattern. I discovered that the version I launch prior to 11:35 PM and nearly all the pauses and the script I launch if after 11:55 PM worked better. I copied and then modified the 11:55 PM script into a new 11:35 PM script. IF I am remembering correctly the bad 11:35 PM script would go to an input box and a second command would be used to type in the input compared to the good 11:55 PM omitted the click in the input box prior to entering the data.

In my case, the website that the script is used on has far less traffic from 10 PM to 6 AM. The script failure rate is much lower during that period. Although the issue seemed to be resolved with a change to the script, I believe that the issue was with the website’s response . The number of failures were much higher whenever I ran the script outside low use period.

Not a direct answer, but hopefully something will getting you going the right direction.

Thanks for all the info. The issue is - the macro should never just stop without an error, even if the website would behave strange. So we will take this test case, debug it and see what we find (it just might take a bit, as this looks like a tricky issue).

Yeah I know sites can implement methods to slow people down, however I did not have this issue until after the latest Kantu update. Also, if I hit resume it instantly kicks back up and starts working again so I’d think if it was Amazon blocking me that wouldn’t be the case. I’ve been blocked by sites before haha, I don’t think that’s what’s going on here.

Were you able to replicate the stopping issue from running this? Thanks for looking into this. Like I said it pretty much always starts right back up if I hit resume but it’s kind of annoying because then I have to babysit it while it’s running.

563 step macro! Wow!

Hello, same issue here! Macro stop in random command each time.

No error, it simply remains frozen, without continuing.

Macro fail 100% of the time, because my loop is infinite, or almost.

Sometimes fails at 60 minutes, others at 3, or 10… is completely random (apparently).

I have tried in chrome and firefox, it does not matter that there are more tabs and I’m doing other things, or just one tab for the macro without touching anything else on the pc, alway fail.

Click pause and click resume is the only solution, but it requires manual presence, obviously …

I leave my code in case you want to try
It work on any profile of instagram “https://www.instagram.com/INSERT_HERE_PROFILE
then, click on ‘followers’, when the list of ‘followers’ is displayed, then play the macro, The operation is simple, make scroll down.

{
“CreationDate”: “2018-10-20”,
“Commands”: [
{
“Command”: “storeEval”,
“Target”: “0”,
“Value”: “N”
},
{
“Command”: “while”,
“Target”: “${N} < 4000”,
“Value”: “”
},
{
“Command”: “storeEval”,
“Target”: “${N}+1”,
“Value”: “N”
},
{
“Command”: “click”,
“Target”: “/html/body/div[3]/div/div/div[2]/ul/div/li[${N}]/div/div[1]”,
“Value”: “”
},
{
“Command”: “endWhile”,
“Target”: “”,
“Value”: “”
}
]
}

Thanks

Note: I’ve also tried make loop with label instead of ‘while’, but same result

I also have this issue

1 Like

This issue is also affecting me. I’m running Kantu in Firefox 65.0.1 on MacOS Mojave (10.14). My macro will pause (without indicating a pause) on random commands. Sometimes it will stop on a storeEval, other times on a clickAndWait. As others have stated, clicking Pause then Resume causes the macro to continue without issue. No errors are present in the logs.

I’ve included my macro below:

{
  "Name": "Update RouteOp Contraints",
  "CreationDate": "2019-3-1",
  "Commands": [
    {
      "Command": "csvRead",
      "Target": "feb-district-customer-contraints.csv",
      "Value": ""
    },
    {
      "Command": "open",
      "Target": "https://app.######/search",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "name=LocationCode",
      "Value": "${!COL1}"
    },
    {
      "Command": "echo",
      "Target": "Location code: ${!COL1}",
      "Value": ""
    },
    {
      "Command": "clickAndWait",
      "Target": "id=butSearch",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "1",
      "Value": "counter"
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!statusOK"
    },
    {
      "Command": "while",
      "Target": "(${!statusOK} == true)",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "2",
      "Value": "!timeout_wait"
    },
    {
      "Command": "verifyElementPresent",
      "Target": "css=div#modal.ui-dialog-content",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "${!statusOK} == true",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "css=button.modal-alert.ui-button",
      "Value": ""
    },
    {
      "Command": "pause",
      "Target": "1000",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "3",
      "Value": "!timeout_wait"
    },
    {
      "Command": "store",
      "Target": "true",
      "Value": "!statusOK"
    },
    {
      "Command": "verifyElementPresent",
      "Target": "//table[@id='ProgramsTable']//tr[@class='collapsible'][${counter}]",
      "Value": ""
    },
    {
      "Command": "gotoIf",
      "Target": "${!statusOK} == false",
      "Value": "noMoreServices"
    },
    {
      "Command": "store",
      "Target": "10",
      "Value": "!timeout_wait"
    },
    {
      "Command": "echo",
      "Target": "${counter}",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "${!statusOK}",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "${!URL}",
      "Value": "currentUrl"
    },
    {
      "Command": "clickAndWait",
      "Target": "//table[@id='ProgramsTable']//tr[@class='collapsible'][${counter}]",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=butEdit",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL4}'.toLowerCase().indexOf('mon') > -1)",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=RouteOptIncludeDay1",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL4}'.toLowerCase().indexOf('tue') > -1)",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=RouteOptIncludeDay2",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL4}'.toLowerCase().indexOf('wed') > -1)",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=RouteOptIncludeDay3",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL4}'.toLowerCase().indexOf('thu') > -1)",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=RouteOptIncludeDay4",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL4}'.toLowerCase().indexOf('fri') > -1)",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=RouteOptIncludeDay5",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL4}'.toLowerCase().indexOf('sat') > -1)",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=RouteOptIncludeDay6",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL4}'.toLowerCase().indexOf('sun') > -1)",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=RouteOptIncludeDay7",
      "Value": ""
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL6}'.length > 0)",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "'${!COL6}'.split(' ')[0]",
      "Value": "startTime"
    },
    {
      "Command": "type",
      "Target": "id=RouteOptTime1Beg",
      "Value": "${startTime}"
    },
    {
      "Command": "storeEval",
      "Target": "'${!COL6}'.split(' ')[1]",
      "Value": "startTimeAmPm"
    },
    {
      "Command": "select",
      "Target": "id=RouteOptTime1BegAmPm",
      "Value": "label=${startTimeAmPm}"
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL7}'.length < 1 && '${!COL6}'.length > 1)",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=RouteOptTime1End",
      "Value": "5:00"
    },
    {
      "Command": "select",
      "Target": "id=RouteOptTime1EndAmPm",
      "Value": "label=PM"
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL7}'.length > 0)",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "'${!COL7}'.split(' ')[0]",
      "Value": "endTime"
    },
    {
      "Command": "type",
      "Target": "id=RouteOptTime1End",
      "Value": "${endTime}"
    },
    {
      "Command": "storeEval",
      "Target": "'${!COL7}'.split(' ')[1]",
      "Value": "endTimeAmPm"
    },
    {
      "Command": "select",
      "Target": "id=RouteOptTime1EndAmPm",
      "Value": "label=${endTimeAmPm}"
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if",
      "Target": "('${!COL6}'.length < 1 && '${!COL7}'.length > 1)",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=RouteOptTime1Beg",
      "Value": "8:00"
    },
    {
      "Command": "select",
      "Target": "id=RouteOptTime1BegAmPm",
      "Value": "label=AM"
    },
    {
      "Command": "endif",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "clickAndWait",
      "Target": "id=butSaveTop",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "${counter} + 1",
      "Value": "counter"
    },
    {
      "Command": "endWhile",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "label",
      "Target": "noMoreServices",
      "Value": ""
    }
  ]
}

This issues requires me to be at my workstation to pause and resume the macro.

Any investigation of this issue is appreciated!

If you know Python or another scripting language, the best and rock-solid way to run a macro reliably “forever” is to use command line: https://a9t9.com/kantu/docs#247

2 Likes

This is a great solution for running a macro that is known to have no inherent issues, thanks!

I can start running some web-fills this way and see if there are any issues. It would still be great to be able to use the GUI to reliably run a loop for an undetermined period without having to Pause/Resume.

:warning: Edit:

I should mention, my web-fill macro has the potential to “Freeze” at pretty much any command, including “type”, “clickAndWait”, “verifyElementPresent” and even “if” statements.

Two things:

  • We confirmed the “stop issue” and we are working on a solution for it.

  • For reliable non-stop automation we recommend to use command line + script method (as mentioned by @ulrich) because it also takes care of non-Kantu issues (e. g. if the website behaves unexpectedly or the browser hangs)

Thanks admin.

FWIW, as a workaround, try your script(s) in Firefox.

I have the same issue in Chrome and for me it doesn’t occur when using FF (but no promises other issues will not emerge!).

Same issue for me as well. Thanks.

Seems it’s happening in Firefox now :frowning:

this a big problem!!

In my experience, my macros run for more loops through Chrome than they do from Firefox.

Kantu also runs marginally slower via Firefox.

This just happened to me a few times too. I thought it was some chrome extensions, so I disabled or removed all of those. I got to about 83 loops this time before the random pausing. It’s waiting on a DOM element that is there. I have to manually enter the next step on the browser for the script to continue.

According to this post by @admin :

We were able to recreate this issue, it seems to be an issue with the Windows message queue. It does not happen on Mac or Linux.

I took a look at my list of windows features a la the “Turn Windows features on or off” menu and I did not have this service installed.

I’ve installed it, rebooted the computer and I ran a macro I have that has been hanging the past few days every 20-60 loops. Since installing the service, at the time of typing out this post I am @ 171 of 563 loops [42 lines w/ several if statements and label/gotoLabel]. Whether this is a fluke, I don’t know; but I will update this post with just how far it had gotten today.

As a side note, I think recent iterations/releases have made the problem worse, as I could average more loops before stalling and I can no longer Pause/Resume to get the macro to continue where it left off. I’ve been considering rolling back the Chrome add-on and may do so back to mid-June back to before, what seems to be, when this issue was being reported.

EDIT: This run ultimately made 292 successful loops before stalling. False alarm…