How to dynamically obtain the URL of a web browser?

I am using UiPath Studio to log in to a web page. When the path contains the string “/home”, it means the login was successful. When the path contains any other string, it means the login failed. How can I dynamically obtain this success/failure path?

Hi @shenyu

Once you usen open browser url activity and next use element exists of home page of Boolean value is true consider as success if not in else consider as failure

Thanks
Ashwin.S

Hi @shenyu - Instead of checking the path, how about using Element Exists activity, to load the page successfully or no.

Activities - Element Exists (uipath.com)

@shenyu

Basically, the login success/failure is determined by the presence of any unique Ui element inside the successful login page. Identify any element which indicated the successful login & then check for its presence using Element Exists activity. If it is present, then you can proceed with the process, as the login is successful.

But, if you still want to proceed with the URL’s /home presence login, you can do it like this:

→ Use a Get Text activity & obtain the text from the address bar of the browser by indicating the same.

→ Save the output of the Get Text activity in a string variable & use the function Contains to check for the /home presence in an If condition.

yourStringVariable.Contains("/home")

Hope this helps,
Best Regards.

There’s a Get URL activity that you can use to obtain the URL of the current page.

depending on some details, but in general we can later retrieve it from the attribute with the name “url” with a get attribute activity or by code: myUiElement.Get("url").ToString

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