Next Tab (tab=1) Fails inconsistently in Chrome

If looping a macro that contains:

{
  "Command": "selectWindow",
  "Target": "tab=1",
  "Value": ""
},

Forums suggest that this goes to next tab. The first loop works correctly. Subsequent loops fail inconsistently - anywhere from the second to the nth iteration. That it’s inconsistent may be a bug. That it’s going to the next tab to the right more than once implies that at least some of the time the reference zero tab is being reset on loop.

Calling commands as follows also succeeds at Next Tab the first time, but always fails on the second iteration:

{
  "Command": "run",
  "Target": "A Series of Commands",
  "Value": ""
},
{
  "Command": "selectWindow",
  "Target": "tab=1", //THIS SUCCEEDS
  "Value": ""
},    {
  "Command": "run",
  "Target": "A Series of Commands",
  "Value": ""
},
{
  "Command": "selectWindow",
  "Target": "tab=1", //THIS FAILS
  "Value": ""
},

Testing indicates that this is not a next tab scenario, but that the tab focused at the start of the process is tab zero, no matter what tab it is counting from the right. Going to a named tab avoids Error 101 if an external command has run (I think), but the tab focused initially is still tab 0. So first instance of next tab: tab=1, next tab=2, etc. Why just tab=1 on repeat sometimes works in a macro that’s looping, and sometimes not, I have no idea, but for calling a macro from another macro, it looks like we’re stuck with tab=1, tab=2, etc. relative to first position:

{
“Command”: “run”,
“Target”: “A Series of Commands”,
“Value”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=1”, //THIS SUCCEEDS
“Value”: “”
},{
“Command”: “run”,
“Target”: “A Series of Commands”,
“Value”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=2”, //NOW INTO THE SUBSEQUENT TAB, SUCCESS
“Value”: “”
},

Assuming I’m not committing horrible atrocities somehow, it looks like tab selection needs to be done outside of a loop if one wishes to change tabs once per loop.

Can you please post a screencast of this? This helps to understand the issue faster.

No, I cannot. Also, because this needs to be 20 characters or more, I’m adding this sentence as well.

Hmm… and why not? Because the website is confidential?

Or, can you add a test case I can run? Maybe using a public website?

Confidential - and I can’t duplicate the problem of looping new tab in a process, as in the first case - outside the confidential site. I can, however, duplicate the second case with random tabs in chrome open to be refreshed. Two macros, first:

{
“Name”: “Test Case”,
“CreationDate”: “2021-4-26”,
“Commands”: [
{
“Command”: “pause”,
“Target”: “1”,
“Value”: “1”
},
{
“Command”: “refresh”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=1”,
“Value”: “”
}
]
}

Second:

{
“Name”: “Test Case Base”,
“CreationDate”: “2021-4-26”,
“Commands”: [
{
“Command”: “run”,
“Target”: “Test Case”,
“Value”: “”
},
{
“Command”: “run”,
“Target”: “Test Case”,
“Value”: “”
},
{
“Command”: “run”,
“Target”: “Test Case”,
“Value”: “”
}
]
}

If you loop the first macro, it’ll theoretically step through your tabs. If you run the second macro, it calls the first macro three times, but only steps one position right from the initially focused tab.

If I can duplicate the problem in a basic loop somewhere, I’ll put that here.

To avoid this problem you must use selectWindow with title this resolve any tab switching problem

https://ui.vision/rpa/docs/selenium-ide/selectwindow