Make selectWindow more reliable?

Is there any way to make selectWindow more reliable?
I’m using Vision with a loop where the site will open a new tab after clicking a button and selectWindow is used with the title of the new tab to continue in that new tab but it works only around 95% of the time. When it doesn’t work the tab is there with the expected title but for some reason it didn’t find it. Error is:failed to find the tab with locator ‘title=tab title’.
I tried with adding pause before the selectWindow and decreasing the command interval in the settings but it doesn’t change.
Is there a way to let it call the selectWindow a couple times while in the settings “if error happens in loop” is still set to stop?
Or is there an alternative (beside selectWindow with the tab number)? It’s always the tab which is visible so having a function which activates the visible tab would also help.

1 Like

What if you use the tab number e. g. t=1 instead of the title, does this work better?

selectWindow | tab=1

I leave the old page open as it allows me to track more reliable where it run into an error. (It doesn’t seem to be an issue with to many pages open as it can happen for the second page or twentieth)
i.e.:
start page opens tab 1->switch to tab 1 and do some work there
browse in tab 1 to new page->open tab 2->switch to tab 2 and do some work there…

With selectWindow+tab it would need an increasing index but I’m concerned that might end up running into issues and doing the wrong page. While the title of a newly opened page is always unique.

Ok I tried it with selectWindow tab=${!LOOP} and verifyTitle in the next line to make sure it’s the correct tab but it’s the same issue.
It randomly doesn’t find the tab in the selectWindow line even though it’s open. Error is:
failed to find the tab with locator ‘tab= 9’

I stopped using the command.
and for this reason I am not able to do many automations.

Yes it’s annoying. My plan was to let it run overnight but now I’m stuck as it breaks every minute or so on selectWindow.

I have found some try catch emulation. Will see if I can work around the error manually.

Ok, ignoring the error and retrying doesn’t work. After selectWindow produces the error once it produces it every time. After the error appears I have tried to continue with reloading the page, opening a new tab to work from there, switching between tab=… and title=… but nothing works. Looks like if the error happens once the macro loop is basically broken at that point and it won’t work again.

Only option I see at the moment to work around this is another automation software which checks if an error appears with selectWindow and restarts the macro loop if so.

its very important command and I cannot do many automations with random bug.

2 Likes

Hello, I am getting exactly the same issue having unreliable access to selectWindow within a loop. Does anyone have a solution on this? Thanks!

1 Like