How To : Kill All IE Browsers Except Selected One (Using Find Children Activity)- UiPath (By Pinky Agrawal)

We all have faced this many times where in we need a specific browser window to be open and all others to be closed. Killing the browser PID, will definitely close/terminate all the browser windows, but that’s what we don’t want. We want our specific window to remain open .

Let’s take an example: We have multiple IE Window open with following URLs:

  1. https://intouch.rpatools.com/home
  2. https://intouch.rpatools.com/category
  3. http://www.msn.com/en-sg/
  4. https://www.uipath.com
  5. http://www.rpatools.com

Let’s say, We need to close all the Browser Windows except the one starts with “intouch.rpatools.com”. When we inspect the browsers, their title looks something like:

  • <html title=’Robotic Process Automation | UiPath’ />
  • <html title=’MSN SG – Latest News, Outlook, Skype, Hotmail, Bing’ />
  • <html title=’RPA Tools | RPA Jobs | RPA Discussions | RPA Articles’ />

How to Do?:

Drag “Find Children” activity into the designer panel and update the following parameters value and store the value in variable called “browsers”

  • Filter = “<html />”
  • Scope = FindScope.FIND_TOP_LEVELS

Drag “For Each Row” activity into the designer panel, So that we can Loop(Iterate) through the “browsers” variable obtained from the above step.

Drag “Log Message” activity into the designer panel, so that we can see the Browser Selector every time we Loop (Iterate) through the “browsers” variable.

Once we have Log Message Activities,if we run the workflow, we will see all the html titles in the “Output” tab.

Drag “Get Attribute” activity into the designer panel, so that we can get the URL from the browser.

Drag “Assign” activity into the designer panel and assign the intouchURL which we do not want to close.

Drag “IF” activity into the designer panel and have the following:

Condition: URL isnot Nothing and URL.Contains(intouchURL.ToString)

Close Window Should have following Properties:

Note: For detail description refer: https://docs.uipath.com/activities/docs/find-children

Download the Sample Workflow from here