How to close tab if a more than one tab is present in internet explorer

activities
web

#1

Hi,
I have below requirement.
There are two tabs in internet explorer. I want to close a tab based on a specific element(a link) exist on that tab.
Can anyone help me how should i achieve this?
Or is there any way in which i can activate a browser window where my specifc UI element exist?
Thanks and Regards,
Vishal


#2

Hi,
Once you identify the specific element exist use following shortcut

  • ctl+1(for the first tab)…2,3,4 on so on. which will focus the tab.

  • ctl+w to close that visible tab

Or
you can make use of close Tab activity and pass the browser variable(make sure you create browser variable for each tab)


#3

Hi,
Well, I dont want to browse through tabs using ctrl+1,2 and so on.

I want to do following things.

  1. I am opening a browser and clicking on link, which inturn is opening a new tab in the same browser. Now, I want to close the first tab which i opened throough open browser activity. For that, i am checking if a “Home Link” is present or not. But, Robot is not taking control to that tab… It remains on the second tab.

So, My question is, is there an activity in UI Path, which finds the element on the tab and activate the tab.?

Please note that here, both the tabs have same title.

For “Close tab” activity, It would be really helpful if you can provide any example since i am quite new to UIPath.

Thanks


#4

Here we go.
closeTab.xaml (9 KB)


#5

Hi @vishalgajjar11,

One more thing that you can also do is to get the URL from the HTML link and use the Navigato To activity.

It will open that specific link on the same tab.


#6

Hi ddpadil
Question: how do you create a browser variable for this purpose?


#7

Hi @Gary_How,

In Open Browser activity -> Properties UiBrowser ->create the browser variable.

Regards,
Arivu


How to select each line button and click
#8

Hi Arivu

Thanks for the prompt response. However this is for the first tab. What if
I open a 2nd tab, 3rd, 4th tab? How do i create browser variable for each
of them?

Appreciate you help :slight_smile:
Gary


#9

Hi @Gary_How,

Here the firstTab variable is Browser its not related to TAB.
Browser variable contains all the tab.

Refer this

Regards,
Arivu


#10

Hi Arivu

ddpadil mentioned: "(make sure you create browser variable for each tab)"
I wanted to know how to create browser variable for each new tab?


#11

hi @Gary_How,

you can use the send hot key to close the tabs.

here close tab activity is used to close the initial tab or first tab alone. If you want to close other tabs use send hot key to close

Regards,
Arivu


#12

Hi @arivu96

Thank you for your reply. I am able to close the tab. but I just want to know the below:

@ddpadil mentioned: "(make sure you create browser variable for each tab)"
I wanted to know how to create browser variable for each new tab?


#13

Attach Browser or Attach Window, then Create a Variable in the UiBrowser or Window Output property.
It basically just stores the selector information though so isn’t always needed but keeps it organized. You can use this variable in the Close tab or Close Window activities instead of the selector. If you use Close Window you need to click the button for Close Current tab that comes up (but works well, so use either method).

Regards.


#14

Hi @ClaytonM

My situation is that i already have a Attach Browser i.e. tab1
Within this, I used a Hot Key (“ctrl + T”) to create a new tab i.e. tab 2.

I have no problem creating a variable for tab1 but
how do i create a variable for tab2 which is automatically opened by the hot key (ctrl + t) within the first Attach Browser for tab1?


#15

Hi.

You can use another Attach Browser or Attach Window on the tab2. It’s normally good practice to use a new Attach activity for every window, tab, or popup that gets opened.

Hope that answers it.

Thanks.


#16

hi @ClaytonM i am trying very hard to understand what you are trying to advice but to no avail.
Thanks for your help. I think I will create a new thread for my problem .

Gary.