Looping issues, selectWindow command unreliability


#1

Hi all,

I would like to optimize some of my work which includes doing some repetitive selections in salesforce.
Usually, I am opening 5-10 tabs and running some kantu macros on them. It works, but sometimes it is unreliable and problematic. Below are the problems which I would love to solve with your help!

Loop acting strangely when trying to work on several tabs.

Problem is always the same - the loop is skipping some tabs, here is a fresh example.

I have opened 10 tabs and run a simple macro, the outcome: macro completed on tabs: 1,2,4 and 7. Everything in between was skipped. Macro has looped on the last tab.

For your reference below is a sample script which I have tested it on and the logs. Every script I make and loop behave the same.

tested on: https://a9t9.com/kantu/demo/tabs/1 1

Five the same tabs opened, the same web address on each of them.

loop properties: start value:1, Max:5

Outcome: the same as mentioned in the initial post, skipping tabs 3 and 5

script

{
“CreationDate”: “2018-6-28”,
“Commands”: [
{
“Command”: “type”,
“Target”: “id=sometext1”,
“Value”: “a”
},
{
“Command”: “selectWindow”,
“Target”: “tab=${!LOOP}”,
“Value”: “”
}
]
}

log

[status]
Playing macro TESTS
[info]
Executing: | type | id=sometext1 | a |
[info]
Executing: | selectWindow | tab=${!LOOP} | |
[status]
Current loop: 2
[info]
Executing: | type | id=sometext1 | a |
[info]
Executing: | selectWindow | tab=${!LOOP} | |
[status]
Current loop: 3
[info]
Executing: | type | id=sometext1 | a |
[info]
Executing: | selectWindow | tab=${!LOOP} | |
[error][ignored]
failed to find the tab with locator ‘tab=3’
[status]
Current loop: 4
[info]
Executing: | type | id=sometext1 | a |
[info]
Executing: | selectWindow | tab=${!LOOP} | |
[error][ignored]
failed to find the tab with locator ‘tab=4’
[status]
Current loop: 5
[info]
Executing: | type | id=sometext1 | a |
[info]
Executing: | selectWindow | tab=${!LOOP} | |
[error]
failed to find the tab with locator ‘tab=5’
[info]
Macro failed (Runtime 2.18s)

2. Select command Issue

The second problem is with the solution which I figured out for the above looping problem. Instead of looping a single script I have replicated it several times and ended with the following lines:
“Command”: “selectWindow”,
“Target”: “tab=1”, (then 2,3 and so on)

It usually works, but often times it just stops. For example, it will execute the script perfectly for the first and second tab, but after that, it will stop and not go to the 3rd tab or do anything else. There is no error, just no action.

There is no rule for it, sometimes it will execute the whole script for every tab, sometimes it will stop on the 3rd or 5th. When it stops its sufficient to pause it and resume, then it will run again.

The issue usually occurs when the macro will go to a different link within a tab. For example

click on edit
fill out the data
click on save
go to the next tab

And in this scenario kantu usually freezes and do not go to the next tab until I click on pause and resume, then it will continue with the script.

website tested: https://www.roboform.com/filling-test-custom-fields?f=CUSTOM&ttl_select=Mr&field1=&field2=&field3=&field4=&field5=aa&msradio=Married&field4=&attitude=&field_9=&Income=

Outcome: on the first try script did it a halfway, to the 3rd tab and then I had to pause and resume twice to finish it. After another few tries EVERY time when the script reached the command “select window” it was executed but nothing happened after it, so Kantu was changing to the other tab but did not complete the remaining script. To make it clear - after the selectWindow command is executed the script freezes and I have to pause and resume in order for it to continue. I need to repeat this process every time it reaches the selectWindow command.

Here is the script:

{
“CreationDate”: “2018-6-28”,
“Commands”: [
{
“Command”: “type”,
“Target”: “name=field5”,
“Value”: “aa”
},
{
“Command”: “click”,
“Target”: “name=msradio”,
“Value”: “1”
},
{
“Command”: “click”,
“Target”: “/html/body/div[2]/div/div/div/form/input[2]”,
“Value”: “1”
},
{
“Command”: “selectWindow”,
“Target”: “tab=1”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “name=field5”,
“Value”: “aa”
},
{
“Command”: “click”,
“Target”: “name=msradio”,
“Value”: “1”
},
{
“Command”: “click”,
“Target”: “/html/body/div[2]/div/div/div/form/input[2]”,
“Value”: “1”
},
{
“Command”: “selectWindow”,
“Target”: “tab=2”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “name=field5”,
“Value”: “aa”
},
{
“Command”: “click”,
“Target”: “name=msradio”,
“Value”: “1”
},
{
“Command”: “click”,
“Target”: “/html/body/div[2]/div/div/div/form/input[2]”,
“Value”: “1”
},
{
“Command”: “selectWindow”,
“Target”: “tab=3”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “name=field5”,
“Value”: “aa”
},
{
“Command”: “click”,
“Target”: “name=msradio”,
“Value”: “1”
},
{
“Command”: “click”,
“Target”: “/html/body/div[2]/div/div/div/form/input[2]”,
“Value”: “1”
},
{
“Command”: “selectWindow”,
“Target”: “tab=4”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “name=field5”,
“Value”: “aa”
},
{
“Command”: “click”,
“Target”: “name=msradio”,
“Value”: “1”
},
{
“Command”: “click”,
“Target”: “/html/body/div[2]/div/div/div/form/input[2]”,
“Value”: “1”
}
]
}

Here are the logs:

[status]
Playing macro TESTS
[info]
Executing: | type | name=field5 | aa |
[info]
Executing: | click | name=msradio | 1 |
[info]
Executing: | click | /html/body/div[2]/div/div/div/form/input[2] | 1 |
[info]
Executing: | selectWindow | tab=1 | |
[status]
Macro paused
[status]
Macro resumed
[info]
Executing: | selectWindow | tab=1 | |
[info]
Executing: | type | name=field5 | aa |
[info]
Executing: | click | name=msradio | 1 |
[info]
Executing: | click | /html/body/div[2]/div/div/div/form/input[2] | 1 |
[info]
Executing: | selectWindow | tab=2 | |
[status]
Macro paused
[status]
Macro resumed
[info]
Executing: | selectWindow | tab=2 | |
[info]
Executing: | type | name=field5 | aa |
[info]
Executing: | click | name=msradio | 1 |
[info]
Executing: | click | /html/body/div[2]/div/div/div/form/input[2] | 1 |
[info]
Executing: | selectWindow | tab=3 | |
[status]
Macro paused
[status]
Macro resumed
[info]
Executing: | selectWindow | tab=3 | |
[info]
Executing: | type | name=field5 | aa |
[info]
Executing: | click | name=msradio | 1 |
[info]
Executing: | click | /html/body/div[2]/div/div/div/form/input[2] | 1 |
[info]
Executing: | selectWindow | tab=4 | |
[status]
Macro paused
[status]
Macro resumed
[info]
Executing: | selectWindow | tab=4 | |
[info]
Executing: | type | name=field5 | aa |
[info]
Executing: | click | name=msradio | 1 |
[info]
Executing: | click | /html/body/div[2]/div/div/div/form/input[2] | 1 |
[info]
Macro completed (Runtime 24.38s)

I would really appreciate your help with this!


#2

Thanks for the test case! I confirmed the “tabs skipped” issue with your test macro. => I created a ticket for it and we will work on this issue soon.

{
  "CreationDate": "2018-7-12",
  "Commands": [
    {
      "Command": "selectWindow",
      "Target": "tab=${!LOOP}",
      "Value": ""
    },
    {
      "Command": "captureScreenshot",
      "Target": "tab_${!LOOP}",
      "Value": ""
    }
  ]
}

#3

Hi there,
any update on this?
It is getting worse and worse everyday. Now I need to pause and resume everytime I run a script with multiple selectWindow commands, basically every time Kantu reaches selectWindow command - it freezes, so I need to pause it and resume every single time it reaches there… This is very frustrating and has very little to do with web automation.


#4

I totally agree that these “random” issues are especially annoying. We will do our best to fix them. That said, each update takes time planning, developing and testing. We plan the next release for early August.


#5

It turns out that this is not a bug, but a feature (or a bug in the docs):

The reference tab=0 for the selectWindow tab counting is always the currently active tab at macro start. So in case of the above test macro, after the first loop, tab 1 is open at the end of the macro (and thus at the start of new loop). Now, with the next macro loop this tab 1 becomes the new tab 0! That why things shift with each loop.

The solution is to switch back to the initial tab=0 at the end of each loop. Then things works as expected. This macro works:

{
  "CreationDate": "2018-7-30",
  "Commands": [
    {
      "Command": "selectWindow",
      "Target": "tab=${!LOOP}",
      "Value": ""
    },
    {
      "Command": "captureScreenshot",
      "Target": "tab_${!LOOP}",
      "Value": ""
    },
    {
      "Command": "selectWindow",
      "Target": "tab=0",
      "Value": ""
    }
  ]
}