How can I pick an element from a specific tab?

I want to pick an element from a specific tab in the browser. I know I can select the tab using its number, but I’d like to know if there is a way to do so using the tab name instead because the number might change depending on how many tabs are open, but the name will always be the same.

I’ve tried using the name of the tab, but it didn’t work. Is there a way to do what I want?

image

1 Like

Hi @cris-dsc!

The way that the value below the On tab property works is like an internal “tab ID” - you can use it when you open a browser tab using the Open URL activity, and that will assign the ID to that specific tab. If you then use that same ID on any Web Automation activities, the bot will know that it needs to perform the activity on that one specific tab. Of course, you can also open multiple browser tabs with different IDs, and later use those IDs to perform different actions on different tabs. You can even set these IDs dynamically with the Calculate a value option - there’s a great example of how we do this in the Purchasing Management Recipe.

The Use tab number in order option works similarly, but instead of assigning an ID to each browser tab, it’s simply searching for the tab that is on the specified position - the 2nd tab from the left, the 3rd tab from the left, etc.

Currently there is no way to refer to a specific browser tab by its displayed name. As an alternative, I would suggest the following approaches, depending on the nature of the browser tab:

  • If you are opening the browser tab from your workflow (via the Open URL activity), then do not use the Use tab number in order option, and instead write an easily recognizable ID in the value field below (for example, “aliant”) - you should then use this same ID as the value of the On tab properties in all the Web Automation activities that involve this tab.
  • If the tab is opened automatically via your actions in the page (for example, you click on a button and the next page is opened in a new tab), then use the Use tab number in order option and instead of an ID, use the sequential number of the tab (2 if it’s second from the left, 3 if it’s third from the left, etc.)

Let me know if this answer helps you!

2 Likes

Hi @cris-dsc,
I do this for switch chrome tabs:

  • define a variable with insidet the name of searched tab
  • use a loop, with “send hotkey” ctrl + TAB
  • check if current tab is the one you want
  • if not, I proceed to the next, otherwise I continue my elab

GUI Selector ELEMENT FOUND? settings

2 Likes

Hello @cris-dsc, I wanted to follow up with you regarding the solutions discussed above by @daniele_arcangeli and @Ivan_Ramos. Can you please let us know if you were able to try these solutions and if they worked for you?

Please also feel free to share any additional feedback or questions you may have.