Close a Tab!

Hello,I was performing some web automation, and one of the steps is to close tab, I’ll always have 2 tabs open and that’s on firefox,I just wanna to close the second tab,it’ll always has dynamic url (always change)
but will always got this Url ( (the name that’ll change) / )
so,I wanna to choose the tab that include the url + the changeable name

There seems to be ‘close browser’ option only in UIPath. Is there a possibility that you can open different browsers to perform your actions? Are you going to switch between tabs in between while performing the actions? If you are performing actions in the 2 websites separately without switching to the other in between i think you can work with ‘Open browser’ instead of opening tab in same browser, in which case you can easily use close browser

1 Like

Thanks vinutha, and for your reply I’m gonna work with only one browser,and actually the two tabs that I’m talking about must be opened in one browser<Because I click a specific element in the first tab then the second tab open<performing some actions on it,then close it and return to the first tab, then repeat the whole process again )
thanks in advance :slight_smile:

There is “Close tab” Activity is there. So you can use it.

Hey @Hazem

Note- It will close the current activated tab. so if you wants to make sure that it will close that tab then first activate that tab and this activity only supports browser variables so pass it.


There is one simple short key as well you can use.

just fire the “ctrl+w” on that activated tab( You can use this even OS explorer windows as well ).



Thanks for letting me know! I have not tried using this activity for browser with many tabs open. The description of the activity on hover says this activity is to close the browser and i was mislead!

Assuming you have only two tabs

Get attribute (url)

Validate your url, if current tab - ctrl+ w



followed by


For more:

:blush: Pleasure…!!


1 Like

I wanna mention a side note here @vvaidya

as @Hazem said [quote=“Hazem, post:1, topic:4213”]
,I just wanna to close the second tab,it’ll always has dynamic url (always change)
but will always got this Url ( (the name that’ll change) / )
so,I wanna to choose the tab that include the url + the changeable name

So “Get Attribute Activity” with Url activity will return always dynamic url so he will not be sure to validate although he can match the domain pinterest url but it will be simple to use here
Get Attribute” Activity with “title” attribute so it will return the Title(you can use wildcard as well if title also showing username or some dynamic string) of that tab so @Hazem will be able to validate that and can use close tab on it either using “Close tab” Activity or “ctrl+w” shortcut key.

If you use IE, then you’re using Windows, which means you’re probably familiar with the ALT + TAB shortcut key for switching between open applications. If so, then all you have to do to switch between tabs in IE is to press CTRL + TAB. That will simply rotate your through all the tabs going forward and then starting from the beginning again when you reach the last tab on the right.

If you want to go the other way, right to left, then press CTRL + SHIFT + TAB. If you want to go to a specific tab, you can press CTRL + N, where N is a number between 1 and 8. Unfortunately, you can’t go past 8, so if you have more than eight tabs, you’ll have to use a different keyboard shortcut or just click on it. CTRL + 9 will take you to the last tab, even if there are more than 8!



May i know can i use this activity to close 2 tabs one by one in the same time? i hit the problem called uninitialized Ui node…

I have used the Close tab activity. Once the execution finishes then close the browser tab. But for me its closing the browser but shows the below exception.


Please provide solution…

Hey @pratiklondhe

it is a problem with your selectors, check them with UIexplorer first.


Its shows same error after execution. Uninitialized UI node.