Web Browser (Legacy) - Get URL

Declaration

<AMBROWSER ACTIVITY="get_url" SESSION="text" RESULTVARIABLE="text" />

Related Topics        

Description

Retrieves the session's active URL and populates a variable with the result.

NOTE: Automation can be performed on Internet Explorer and Firefox browsers only. Firefox automation requires a separate extension which can be downloaded from here. The browser you specify must be installed on the target system to ensure that these activities function properly. Unlike other session-based actions in which sessions are optional, the use of a session in the Web Browser (Legacy) action is required due to the fact that each created session explicitly links to a specific web browser instance. A session can be created using the Web Browser (Legacy) Create session or Open activity. Numerous sessions are supported within a single task, however, since Web Browser (Legacy) actions are performed interactively (and not in the background), each session must run concurrently to avoid sending interactions to the wrong browser window.

Practical Usage

Used to retrieve a URL from an active session.

Parameters

Browser

Property Type Required Default Markup Description
Session name Text Yes BrowserLegacySession1 SESSION="mySession" The name of an existing session to attach this activity to. Numerous sessions can exist within a single task allowing several web browser operations to be performed simultaneously on separate browser windows.
Place session's active URL in variable Text Yes (Empty) RESULTVARIABLE="theURL" Retrieves and stores the session's active URL.

Description

Error Causes

On Error

Example

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

Description

A simple task that populates a session's active URL into a variable, which is then displayed in a message box. Thereafter, the task closes the web browser, ending the session.

Copy
<AMVARIABLE NAME="theURL" />
<AMBROWSER URL="http://www.google.com/" SESSION="mySession" />
<AMBROWSER ACTIVITY="get_url" SESSION="mySession" RESULTVARIABLE="theURL" />
<AMSHOWDIALOG WINDOWTITLE="The Active Session's current URL">URL = %theURL%</AMSHOWDIALOG>
<AMBROWSER ACTIVITY="close" SESSION="mySession" />