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:
- https://intouch.rpatools.com/home
- https://intouch.rpatools.com/category
- http://www.msn.com/en-sg/
- https://www.uipath.com
- 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
An RPA Developer with 3+ years in RPA and Intelligent Process Automation (IPA) using Blueprism and UiPath.
Advocate of strong CI-CD deployment and being part of CoE.
Skillsets:
Blue Prism, UiPath, Docker, Python, RPA, Outsystems, Power Apps, Azure, Zend Server, Zend Studio, Zend Guard, CMS, Zoomla, WordPress, Webservices, Linux, Windows, Abby Flexi Capture, Networking, PHP, Power Automate