selectWindow problem, looping issues


#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!

  1. Loop acting strangely when trying to work on several tabs.

(The problem was mentioned and not solved under this topic:
New tab loop fails every time)

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 here is the script which I have tested it on and the logs. Every script I make and loop behave the same, so this is only for your reference.

{
“CreationDate”: “2018-6-27”,
“Commands”: [
{
“Command”: “clickAndWait”,
“Target”: “name=edit”,
“Value”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “name=cancel”,
“Value”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=${!LOOP}”,
“Value”: “0”
}
]
}

[status]
Playing macro 1111
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | clickAndWait | name=cancel | |
[info]
Executing: | selectWindow | tab=$+1{!LOOP} | 0 |
[error][ignored]
invalid tab offset, ‘$+1{!LOOP}’
[status]
Current loop: 2
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | clickAndWait | name=cancel | |
[info]
Executing: | selectWindow | tab=$+1{!LOOP} | 0 |
[error][ignored]
invalid tab offset, ‘$+1{!LOOP}’
[status]
Current loop: 3
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | clickAndWait | name=cancel | |
[info]
Macro was stopped manually (Runtime 24.50s)
[status]
Playing macro 1111
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | clickAndWait | name=cancel | |
[info]
Executing: | selectWindow | tab=${!LOOP} | 0 |
[status]
Current loop: 2
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | clickAndWait | name=cancel | |
[info]
Executing: | selectWindow | tab=${!LOOP} | 0 |
[status]
Current loop: 3
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | clickAndWait | name=cancel | |
[info]
Executing: | selectWindow | tab=${!LOOP} | 0 |
[status]
Current loop: 4
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | clickAndWait | name=cancel | |
[info]
Executing: | selectWindow | tab=${!LOOP} | 0 |
[error][ignored]
failed to find the tab with locator ‘tab=4’
[status]
Current loop: 5
[info]
Executing: | clickAndWait | name=edit | |
[status]
Macro paused
[status]
Macro resumed
[status]
Current loop: 5
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | clickAndWait | name=cancel | |
[info]
Executing: | selectWindow | tab=${!LOOP} | 0 |
[error][ignored]
failed to find the tab with locator ‘tab=5’
[status]
Current loop: 6
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | clickAndWait | name=cancel | |
[info]
Executing: | selectWindow | tab=${!LOOP} | 0 |
[error][ignored]
failed to find the tab with locator ‘tab=6’
[status]
Current loop: 7
[info]
Executing: | clickAndWait | name=edit | |
[info]
Macro was stopped manually (Runtime 73.74s)

  1. 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 sufficent to pause it and resume, then it will run again.

What can cause that and how to amend it?

  1. The 3rd problem, sometimes when working on several tabs I see “Either a played tab or a url must be provided to start playing” error. I am usually running the script through the bookmark to ensure it will be played to the correct tab but still this sometimes shows up.

How to ensure that the script will run on the current opened tab? Is there a way to show Kantu on which tab it should work on without typing an exact URL to the script?

I have 2 screens and on each, there is one web browser window, one I would like to dedicate for kantu macros and the 2nd one for other actions. Is there a way to show the program that is should focus only on one browser window, and ignoring the 2nd one completely?

Thank you for your help!


#2

Fixing any reliability issues is a top priority for us, because obviously, the point of automation is that it works without manual supervision.

That said, the tricky part is to recreate the issue. Once we can do that, things are usually fixed fast.

Can you recreate similar issues (as you described under 1, 2 and 3) with a public website, maybe even our tabs test page https://a9t9.com/kantu/demo/tabs ?

“Either a played tab or a url must be provided to start playing”

This means Kantu lost somehow the connection to the tab (e. g. tab was closed). But sometimes, as in your case, it seems the connection is lost while the page is still there. Again, having a test case for this issue would be super helpful!

Is there a way to show the program that is should focus only on one browser window, and ignoring the 2nd one completely?

You can use different Chrome profiles, or simply use Firefox and Chrome.


#3

I would love to see a test case for this… this sounds like some internal timeout that should be easy to fix, once we can recreate it.


#4

Thank you for your prompt response!

Here are the recreations:

  1. “Loop acting strangely when trying to work on several tabs.”

tested on: https://a9t9.com/kantu/demo/tabs/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)

  1. tab command and Kantu freeze

Its worth mentioning that the issue presented in the initial post usually occurs when 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)

Hopefully you can help me with this! Thank you for your help!


#5

Any update on this? : )