uipath technical infomation for everyone

Get browser URL

Currently, there is no activity to get the browser URL directly.


1 Prepare a JavaScript file for URL acquisition.

The file name saves the file with the extension “js”. Here, it is saved as “GetUrl.js”.


 Function (e) {
Returns window.location.href.



2 Place an activity to inject a JS script.

Inject JS Script activities are placed in the Open Browser Activity and Attach Browser Activity entities.


Add a browser When placed in an activity, JavaScript will be executed on the opened page, so it is necessary to specify the Inject JS Script activity selector-.



3 Insert a JS script Set the properties of the activity.


Properties Commentary
ScriptCode Specify a file that describes Java Scrit. Here, “GetUrl.js” created in “1.” is specified.
ScriptOutput Specify a variable to receive the return value obtained from JavaScript. Here, a String type variable “strLocation” is specified.


Robot execution result