How to switch back to first tab after opening multiple tabs in the same browser?

I have opened 4 tabs on the same browser using control + T (hot key) and navigation. Now I want to go back to first tab and execute certain actions and serially move on to second, third and fourth tab and close all the tabs one by one. How can I achieve this?

Hi,

You can use windows shortcut for the same:
control+1 = to move to the first tab
control+2 = to move to the second tab
control+3 = to move to the third tab and so on…

Pls mark it as solution if it solves your issue.

Thanks

1 Like

Hi @Samraat_Maharjan1

You need to drag and drop and use application/browser activity and attach each tab, then perform the actions you want there

also you can rehuse multiple instances creating an output variable and passing to the same use app/browser

We also recommend to use the Go to URL activity instead creating lot of tabs using ctrl + T keys

Regards

@Samraat_Maharjan1

Multiple ways…two of them

  1. Use the window titles to identify the tab and close the required tab or click on close
  2. Use the output of the first use browser where you would have opened the tab and pass them around to get the window details.each browser activity will give an outout variable type of uielement/browser which can be pased in the bext activities and use it instead of selectors again

Hope this helps

Cheers

Okay, short key control+number is working for switching tab to first or second tab. Now I want to close that tab and do the certain number of tasks on the second tab as well. How can I close that finished tab only.

I have used loop to open multiple browsers. It will be tedious to set output for each tab (say 5). I might need to open 10 tabs using loop. Btw, how can i close particular tab only (first tab)

Hi,

First switch to the required tab, then perform your operations and again send hotkeys Control+w to close the tab.

Mark it as solution if it solves your issue.

Thanks

2 Likes

@Samraat_Maharjan1

You can create a list of uielments and add those variables to the list…Then using index of list you can get each tab …which can then be used later to close the tab as you anyways need using index

cheers

how can I close specific tab only (say first tab only) and do my task in second task (same process).

HI @Samraat_Maharjan1

you can use the navigate browser activity with close tab property set in action

Regards

wouldn’t it close all the tabs ? I want to close only first (one) tab.

Make sure you are in the correct tab, check the selector matchs the correct tab and it will close only the selected tab

Regards

The problem is all the tabs are of the same link.

Hi,

@Samraat_Maharjan1 have you tried this?

Thanks

after I closed one tab I couldn’t process same task in another tab because of selector issue

Do you have any documents or blogs for this (regarding uielement and index)? I am not getting your point. It isn’t very clear to me right now.
BTw can we sue this index of list using other loops (other than for each)?

@Samraat_Maharjan1

This is what I am trying to explain

Basically inside your loop open each tab…and save the output uielement that you get to alist by adding the value to list…then later when you want to close you can use

ListArr(0) which will give the uielemnt for first tab…and then close it…using a click on close or close tab which ever workd…listArr(0) will give the first tab and can be passed in the input element field

cheersh

1 Like

when I created ListVar. it’s variable type is showing iList instead of list<Uielement< how can i changed that?

@Samraat_Maharjan1

Click on browse for types in the variable field…then select

System.Collections.Generic.List and then from the drop down on the top beside list select browse for types UiPath.Core.UiElement

image

cheers

1 Like

and what is this error : Append Item to List: Object reference not set to an instance of an object.