The macro lost the tab identification number inside a loop

Hi!
A have one page with several links inside a table. For each link opened I have do scrap the text and fill an another page. Return to the next link and do the same operation.

In detail the operation has the following steps:

  • For each link on the page (Figure 1)
    • On the page opened (Figure 2)
    • Then, I use the XRun command to load the page that I want to be filled (Figure 3)
    • Return to the page opened e scrap all elements (selectwindow tab=0) (Figure 2)
    • Return to the page that should be filled e scrap all elements (selectwindow tab=1) (Figure 3)
    • Return to the pages with the links (Figure 1)
  • Repeat

In the first step it is ok. But on the next when the program tries to return step c of the second cycle (selectwindow tab=0) (Figure 2).

It seems that (figure 4) it tries to open a tab with id 9 , rather than the tab with id=0. Altough at this moment there is only two tabs opened.

Obs: The page opened (Figure 2) is loaded in the same tab as the first one (Figure 1)


uivision_tab2
Figure 4

Observation:

I’ve already tried to return to the first page (Figure 1), without success using, the EXECUTESCRIPT command with window.Historiry.go(-1) or using the XTYPE command . My solution was to load the page with the links directly using the open command.

Unfortunately when changing browser tabs often identify prolemes happen and are often very difficult to resolve.

Sometimes I had to create macros that close all the tabs to avoid having problems to identify them.

The ideal is to create automations that do not open and close tabs otherwise sudden problems can arise that are difficult to solve.

Remember that each automation can be created in various ways often after thinking better I found better solutions than the first one I had thought.

Always try to prevent you from opening multiple tabs in the browser during automation is easy that you will have so many problems in this case

Thank you, I will try to think an another strategy.
Best,
Leonardo

You can switch in tabs with shortcut CTRL 1 (or 2 - 3) but in my test ui vision continue to work in old tab.

Need a solution to set the new focus tab after switch with shortcut.

Hi!,

Could you explain me your advice? Because I’ve had difficult to understand it.

1.You can switch in tabs with shortcut CTRL 1 (or 2 - 3) but in my test “ui vision continue to work in old tab”.

  1. I’ve guessed that if I used a command like executeScript or XTYPE would be suficient to set the focus on the tab.
    Need a solution to set the new focus tab after switch with shortcut.

Finally, I’ve tried several types the commands to return to the tab on the left or on right, that I’ve imagined to be a trivial question, but unfortunately not function even on both Firefox and the Chrome.
Below I list the commands that I used:

Best,
Leonardo
{
“Name”: “teste2”,
“CreationDate”: “2020-10-15”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://www.google.com”,
“Value”: “”
},
{
“Command”: “comment”,
“Target”: “open // https://www.uol.com.br”,
“Value”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=open”,
“Value”: “https://www.uol.com.br
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “window.history.go(-1);”,
“Value”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “window.history.back();”,
“Value”: “”
},
{
“Command”: “XType”,
“Target”: “{KEY_CTRL+KEY_1}", "Value": "" }, { "Command": "XType", "Target": "{KEY_BACKSPACE}”,
“Value”: “”
},
{
“Command”: “XType”,
“Target”: “{KEY_ALT+KEY_LEFT}", "Value": "" }, { "Command": "XType", "Target": "{KEY_CTRL+KEY_PAGE_UP}”,
“Value”: “”
},
{
“Command”: “”,
“Target”: “”,
“Value”: “”
}
]
}

The best solution is working only in one tab, i usually save a part of work, close all tabs and reopen one tab to continue working.

Open and close tabs is very dangerous for automation because change the tab numer and ui vision detect tab number in wrong mode

A solution to bypass tab numner (when you open and close tab number change) you can use title to detect a tab

selectWindow | title=y

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

Other solution are hard to create and need to know the new tab number after you close and reopen tabs.

OK, I will try.
Thank you,

Leonardo