How To Select Firefox Browser Window From Multiple Opened Instances?



Hello, I have created multiple Firefox profiles.

To open them I used Start process activity from System->Application section.
I created 3 such processes, all of them have such attributes:

Arguments = "-p -no-remote NameOfProfile"
FileName = “C:\Program Files (x86)\Mozilla Firefox\firefox.exe”

where NameOfProfile is a Firefox profile name created earlier and there are 3 different names.

What it does is that it open 3 separate Firefox independent instances.

What I’ve tried to do is to navigate 3 Firefox browser windows each to different websites.

I’ve tried to specify it like this in Attach Browser Target Selector "<html app='firefox.exe' idx='1' />" where idx should be the firefox instance number but this doesn’t work.

While when I was selecting what to do in multiple opened tabs of the same instance idx parameter works.

UiExplorer doesn’t help because it shows the same attributes for each of the 3 windows.

Thank You for Your help!


Solution attached: Browsers.xaml (11.0 KB)
(12.3 KB) that uses a UiBrowser variable which is passed to the Attach Browser activity (note that in this case no selector is used in the attach).

You’ll need to use Open Browser instead of Start Process. I’m using IE since I don’t have Firefox installed.


Thank You @badita it works ok but in my case I only can use Firefox browser with specific to Firefox addon.
As I mentioned I’ve tried to open 3 separate & independent Firefox instances.
To do that the are 3 Firefox profiles.

And independent means that I can login to specific website in one instance with one account and to do the same on second instance but with other account and they will work independent of each other.

While Your proposal opens several browser windows but even with new session option checked they are not independent and for example if You will login to YouTube website on one instance and navigate to YouTube website on other instances You will see that You are already signed-in, at least it is so in Firefox.

That can be accomplished by using Firefox profiles.
And to open several specific profiles the best solution I’ve found was to Start a Process because it offers an option to specify the parameters to pass to the application You want to open.

While by using Open Browser You can’t specify those parameters and it just opens default browser profile.
And if to use Open Application instead of starting process even if to specify output variable it shows a message to specify selector while in Your example it works without selector.

Maybe there is another way to identify specific window like Application PID or something like example with idx parameter I’ve mentioned while there are multiple instances of the same application running (not just a web browser but in general any application) that will work in such situation.

In UiExplorer You can’t select Firefox as a window You can select only tab or any other element inside Firefox window.


Check the Private option under Open Browser and it should be ok.

What Firefox version are you using? Should be 50 or up.


Thank You @badita for helping out.

I’m using Firefox version 50.0 (currently the latest).

I’ve tried setting Private options in different combinations either under Open Browser and Attach Browser in the Options and in the Misc. Sections and I’ve opened 2 Firefox instances but this also doesn’t work.

It seems like the only option in Firefox is by using Profiles.

If Open Browser activity also contained the option to pass arguments (as in Start Process) to the browser it opens so it can use different profiles then the browser window selection process in Firefox was as in Your example by using the Output variable after that in the Attach Browser activity.


I did more testing and found something strange.

If to open 2 Firefox browsers using Open Browser action regardless if to check Private option or not the UiExplorer shows:

  1. 2 Firefox applications & 2 Firefox browsers with the same PID

  2. Both bowser instances can be selected, highlighted correctly and their selectors can be validated by pid but only You need to also specify browser window title and both of them should be different (their urls should be different) by using selector <html app='firefox.exe' pid='Number' title='Title' /> where Number is it’s current pid and Title - Firefox browser window title.

  3. Firefox instances act as not independent, You can’t login for example to YouTube with one account in one browser window and with another one in the second browser.

If first to open Firefox browser by using Start Process action and before opening it set for example as a homepage and option to open homepage at start for every Firefox profile then to use Attach Browser activity and to set arguments with different profile names and to set Selector as "<html app='firefox.exe' url='**' />" and as Output set browser1 variable and then Navigate this instance to for example and then do the same procedure with the second instance except to Navigate it to different website there will be Error message while executing the second Attach Browser action while the first browser instance worked correctly and shows youtube url instead of google. And in this case UiExplorer shows:

  1. 2 Firefox applications & 1 Firefox browser with different PID

  2. The second Firefox browser that is shown in UiExplorer not as browser but only as application can’t be selected, highlighted, and it’s selector validation rises an error that there is no such element by it’s pid by using selector <html app='firefox.exe' pid='Number' /> where Number is it’s current pid. While the other instance which is shown as browser and as application can be selected, highlighted and it’s selector validates correctly by using it’s own pid which is different to the first browser instance.

  3. Firefox instances act as independent, You can manually (not by using UiPath Studio) login for example to YouTube with one account in one browser window and with another one in the second browser.


Is there a way to include an option to specify arguments in the Open Browser activity? Like to include it in nupackage, where there is Open Browser activity, manually or some kind of development tool to do this as it may be the only way to be able to use Firefox profiles correctly if it will be able to highlight different instances correctly with different pid’s.


Hi Coby,

Not using Firefox nor multiprofile with automations, so can’t help with that, but I’d like to clear that PID attribute is not supported for <html> tags (confirmed as of yesterday in regards to some other issue). Don’t know if it will be supported in the future.

So while your initial finding of Firefox tabs was successfull, it’s because of the title attribute, not PID.
I’ve ran into a very similar thing with Chrome in the past, where I’ve ended up doing an InOutArgument with a text selector regenerated at the end of each workflow using Title (it was enough for my case as I only needed to differentiate between different open webapps).

Please also note that, as you discovered, PID is not always a differentiating element for Firefox tabs (and Chrome tabs), due to the architecture of those browsers, so even if it would be supported, it wouldn’t help/could be unreliable.

There might be a workaround, not sure if it’ll work for your case… Only tested something similar with IE, but might be worth a try.
Find an UiElement based on absolute selector that has a per-user difference (for youtube that might be the user profile element in the top right corner), get the top level window for it, check if it’s a browser (IsBrowser method, just in case) and if true, do a GetBrowser call and attach that object in the AttachBrowser activity.



Hi @andrzej.kniola,

Thank You for reply, I was automating some dynamic websites and was able to do so even in complex cases but before running automation I’ve needed to start Firefox profile manually and then do Attach Browser action inside automation.

There were no problems working with different tabs inside the same window in this case.

The problem is that UiExplorer can only identify Firefox as a browser if there is only one Firefox browser process running in Windows Explorer, if there are more Firefox processes running it will show all the others as applications. Therefore Your proposal doesn’t work here.

For example if to open two instances of Calculator in Windows Explorer it shows them as one process and in UiExplorer You can highlight any of two windows by using idx parameter.