Activities related to browser

Hi,
I have browser automation related question. Can you please clarify?

When I do “Open browser”, do I have create all browser related activities in the “Do block”? Can I delete “Do block” and create the browser related activities outside the “Open browser”? When do I have to “Attach browser” and within “Do Block” create activities?
Thank you for clarifying my questions.

Hi,

Do block of OpenBrowser, AttachBrwoser etc is called container. It provide with function that activities inside it can manipulate same browser-tab/ windows.
And it can pass via Browser (UiPath.Core.Browser) instance to AttachBrowser/Window
This mechanism helps us case there are multiple windows/browsers which has same name, for example.

When I do “Open browser”, do I have create all browser related activities in the “Do block”?

Nope. As we can pass browser instance, we can use activities in Attach Browser and put them in it.

Can I delete “Do block” and create the browser related activities outside the “Open browser”?

Yes, we can put activities of UiAutomation anywhere in classic design mode. However, if we put it outside container, we need to indicate top level window/browser correctly.

Regards,

2 Likes

Thank you!
So I did open browser “https://www.google.com
Outside the container, I did type into “weather today” and clicked Search.
It ran fine.
Instead should I be placing the type into and click inside the container or use attach window with the created browser instance, keep type into and click inside attach window.
Please advise. This is in general for any browser related activities.

Hi there @A_Learner,
Excellent questions and ultimately, it depends.

If your automation is suitably small, you can absolutely include those activities within the Open Browser Container and it will work fine.

In the event your automation is large enough or you are interacting with other applications/instances of the browser, then you will need to keep those activities outside of the Open Browser Container.

If you do have the multiple activities outside of the Open Browser Container, it is generally best practice to use an Attach Browser Container and group them inside there - Anytime you have > 1 activity that interacts with the same browser, it is worth attaching.

That allows them to share a top-level Selector.

Please let me know if you have any further questions.
Thanks once again for your support,
Josh

Hi,

There are mainly two benefit to use activity inside container.

First, we can handle the target browser tab/window even if there are multiple browser/windows which has same name ( or same selector).

Second, each activity inside container is slight faster than outside one, because former doesn’t need to search top level selector. (As it’s already searched by open/Attach browser etc.)

So if we need to handle some activities to the target browser tab, it’s better to use container because of performance. In case of using OpenBrowser and TypeInto as you tried, it’s a little better to put TypeInto inside OpenBrowser for performance
On the other hand, if we need to use just a Click activity for an existing browser, we don’t need to use AttachBrowser.

Hope this helps you.

Regards,

Hi @A_Learner,

  1. Open Browser - UiPath
  2. Attach Browser - UiPath

Please refer to the above reference link for clear documentation of the activities - Open Browser and Attach Browser.

My suggestion about your query:

  1. You can use Open Browser activity and use the related Ui Automation activities outside the open browser activity. The activity which you use outside the open browser will work as Full selector method.

  2. If you choose to use Attach Browser activity, if you choose to use the Ui Automation-related activities then, it will work as Partial Selector.

To get to know even more clear about Full selector and Partial Selector refer to the below link.

Full Selector vs Partial Selector

Thanks,
@90s_Developer

Excellent! Thank you!

Good Points! Thanks a lot!

Thank you! If possible please send me example flows. Much appreciated.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.