New tab loop fails every time

Hi there,

I have some issues with looping my script.

The goal is to do the script for every opened tab. Once the script is finished for the current tab, kantu should go to the next one and execute the script and repeat it to the last opened tab.

Here is the script:

{
“CreationDate”: “2018-5-28”,
“Commands”: [
{
“Command”: “clickAndWait”,
“Target”: “name=edit”,
“Value”: “”
},
{
“Command”: “select”,
“Target”: “id=00N80000003Lv1c”,
“Value”: “label=Recommended”
},
{
“Command”: “clickAndWait”,
“Target”: “name=save”,
“Value”: “”
},
{
“Command”: “selectWindow”,
“Target”: "tab=${!LOOP} ",
“Value”: “”
}
]
}

In order to loop it I click on play loop (upper right corner). The values which I type are:
start: 1
Max: 5

At first, it seems to work, however something is not right and I have no idea what it is since this script is very basic. After running it via ‘play loop’ it runs the script as follows:
1st tab - OK
2nd tab - ok
3rd - SKIPPED
4th- ok
5th - SKIPPED
6th - SKIPPED
7th - it is running twice and then stops

I have no clue whats wrong, I thought that it will start on the second tab (since the starting value is usually 0, but it seems not to apply here) and end on the 6th tab.

Below are the logs:

status]
Playing macro recomend test
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | select | id=00N80000003Lv1c | label=Recommended |
[info]
Executing: | clickAndWait | name=save | |
[info]
Executing: | pause | 2000 | |
[info]
Macro was stopped manually (Runtime 44.33s)
[status]
Playing macro recomend test
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | select | id=00N80000003Lv1c | label=Recommended |
[info]
Executing: | clickAndWait | name=save | |
[info]
Executing: | selectWindow | tab=${!LOOP} | |
[status]
Current loop: 2
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | select | id=00N80000003Lv1c | label=Recommended |
[info]
Executing: | clickAndWait | name=save | |
[info]
Executing: | selectWindow | tab=${!LOOP} | |
[status]
Current loop: 3
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | select | id=00N80000003Lv1c | label=Recommended |
[info]
Executing: | clickAndWait | name=save | |
[info]
Executing: | selectWindow | tab=${!LOOP} | |
[status]
Current loop: 4
[info]
Executing: | clickAndWait | name=edit | |
[info]
Executing: | select | id=00N80000003Lv1c | label=Recommended |
[info]
Executing: | clickAndWait | name=save | |
[info]
Executing: | selectWindow | tab=${!LOOP} | |
[error][ignored]
failed to find the tab with locator ‘tab=4’
[status]
Current loop: 5
[info]
Executing: | clickAndWait | name=edit | |
[error]
time out when looking for element ‘name=edit’
[info]
Macro failed (Runtime 45.40s)

Please explain why it is skipping 3 tabs and on the last one, it runs twice? How to amend this? Is it possible to run the script in the loop for EVERY opened tab without specifying the values? I mean I will open plenty of tabs, let’s say 20, and I don’t want to count them, I want the software to run the script for every opened tab. Is it doable? If yes how to proceed with it?

I am confused. You say:

but in the log file I see:

[status]
Current loop: 3

…so the 3rd loop is not skipped?

Maybe a tab handling issue? But to test this, the complete macro is needed (so I can test run it on my Mac).

Thanks,
I have provided the code in my initial post. I am afraid it will not help you since you will not have access to this website. The code is not necessary. the problem appears every time with every script I test.

The main issue here is the fact that the script is simply not looping. If I have 5 tabs open it will do the script for the first two and skip the third one (ALWAYS) and then it proceeds to do random stuff. I believe my request is simple. I would like to repeat the script for every opened tab.

I was trying to use this piece of code after the main script in order to loop it for all the opened tabs:

{
“Command”: “selectWindow”,
“Target”: "tab=${!LOOP} ",
“Value”: “”

but it is not working properly, I believe that there must be a more reliable solution, I have found another user on this forum with the same issue and his problem wasn’t solved. I hope someone will help me with this.

Please provide a code or an instruction how to loop the script for every opened tab. Every tab is the same (different data in some fields)

Edit:
it seems like the 3rd tab is not visible.
“failed to find the tab with locator ‘tab=2’”

Same (may be or not bug ) still present at 2022. year within Firefox browser…

In short…:

  1. Macro play good in first tab

  2. Sending command to switch tab ${KEY_CRTL+KEY_TAB} ***

  3. Running macro again from bookmarklet and it is still running in 1st tab instead of 2nd tab, if i have command “OPEN” it execute inside of 1st tab instead of 2nd tab.

Hoping to find solution for this soon.

***(Cause Select TAB=1 or any is not working well or at all, even macro DemoTabs is showing error "Failed to find the tab with locator tab=1)

Overall, UI.VISION is great RPA tool, It is easy to solve almost every challenge with powers of UIVision