Multiple windows/tabs breaking process

Hello,

I have a process that starts by attaching a chrome window. However, I notice that the process will break if the user has multiple windows or tabs open. I think the process does not know what chrome window to attach. The windows are all on the same page but on different sub pages of the main page (example: www.google.com, Google.

Any idea how to overcome this? killing all the chrome sessions and just starting with a new one is not feasible.

Hi

We can use Navigate to
activity in UiPath

And we can replicate the same steps on how you will do it manually

Cheers @Asanka

Hey,

Thats not the issue. I do use navigate to. The issue is, if there are multiple windows/tabs open, the process breaks because it does not know what browser to attach

you can attach a window specific to the one you want to run the process, you need to take help of UI Explorer and use Activate window and use specific selector for your target page

If it is an option, try to have your process run on a different browser so as to not touch the browser user uses.

Yes the issue is they have multiple windows that are the same. So it can’t figure out which one to attach:

Cannot find the UI element corresponding to this selector:
at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID)
at UiPath.Core.UiElement.FindFirst(FindScope scope, Selector selector, IVariableResolver resolver)

If the window is exactly the same then you would have to use close tab for those.

Use Element Exist and point that target window, and close if that exact same window is there.
We would not close all but only those on which the robot gets confuse

Closing the windows/tabs are not an option as they are needed by the user…

Then either go for a different browser or in incognito mode for your proocess.

If there are exact same windows. the robot will get confused surely.

hey yeah that wont work either. the process is logged into an internal system. if we open a new window they will need to log in. its an attended process.

so no way to do it? is there something that is like “get active window” but for “get active browser”?

That is “Activate Window” but it requires some element specific to that target page but as you said there are exactly same pages then that won’t work.

May you can open a different page (from where robot can start processing first few steps)using the robot, that will give you a different window and the selectors that can help to uniquely identify that?

You can store their credentials in an Asset and have your automation do the login. This is the typical way of doing things.

To Attach to an existing window you will have to be able to define a unique selector for it. Don’t just take what UiPath gives you, you can edit selectors.

Are you on modern? The Use App/Browser activity may be better able to give you a unique selector for the window you’re trying to attach to.

Hey,

So we can’t open a different page because it will prompt a login.

Darn, we can’t store their assets in credentials either because of security reasons.

So no way to do this eh? Here is the thing, it does not matter what window it picks, it just needs to pick one. Is there a way to just make it pick one and run with it?

What security reasons? What about using a service account?

If you can determine a selector that uniquely identifies the Chrome window you want, it’ll work fine.

Service account won’t work because its an attended process. The user needs to just run it on their computer.

We cant store that many creds somewhere. Its too many. It would never fly haha

Open a browser window and when it gets to the login page, prompt the user to log in using Message Box. Then continue in that window.

Haha yeah. I may throw that into a try catch. Not ideal but it doesn’t seem like there are other options here.

Doesn’t need a try/catch. Just a message box saying “log in and then click Ok to continue”

Oh i meant a try catch that has the normal attach browser in the try. Not everyone has multiple windows open…

So…just throwing this out there:

Is it possible to get a list of all the open chrome sessions (possibly through get processes) and then build a Uibrowser variable from that?