Get the titles of different tabs opened in IE UiPath

A lot of times while working on web automation we tend to open different tabs on a single browser.

After completing the required steps on that particular tab you need to close that tab but how will you achieve that.

The common way of closing a browser is you declare a browser variable in open browser activity and then use close tab activity.

In this way, it will close the main tab, not the sub-tabs which are opened during the course of this process automation.

But you want to close a certain tab then you need to know the selector or the title of that tab to close it.

In this article, let see how we can get the titles of different tabs opened in IE.

Why IE not any other browser?

I tried this method in three different browsers:

  • IE
  • CHROME
  • MICROSOFT EDGE

It seems to be working only for IE.

Let’s get into the practical implementation of this task:

Step1: The opened tabs in IE is shown below:

ie tabs

Step2: Drag and Drop find children activity from activities panel to designer panel as shown below:

find childern activity

Let’s see the required properties of find children activity:

titles of different tabs

Here:

  • Filter – Provide the tag that is shown in the image above.
  • Scope – Select the find top levels in that property as shown above.
  • Children – It will provide us the selectors of all the opened tabs as this is an IEnumerable of UiElement.

Step3: Drag and Drop For each and Write Line activity from activities panel to designer panel as shown below:

titles of different tabs

The properties tab of for each activity is shown below:

titles of different tabs

Here:

TypeArgument -As the output from find children activity is IEnumerable of UiElement the type argument should be UiElement as shown above.

The output until this point is shown below:

find children activity output

In order to get the titles for these tabs follow the below steps.

Step4: Drag and Drop Get attribute and write line activity from activities panel to designer panel as shown below:

titles of different tabs

The required properties of get attribute activity is shown below:

titles of different tabs

Here:

  • Attribute – Select the title in that attribute property.
  • Element – As our item is a UiElement variable type provide that in this property.
  • Result – This will provide the title of the tab in the IE.

The output after this final step is shown below:

In the above image, we can see the title of two different tabs opened in the IE browser.

Happy Learning!

Like this post then let your friends know about this-:

Leave a Reply

Your email address will not be published. Required fields are marked *