Web Browser - 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 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 Create session or Open Web Browser activity. Numerous sessions are supported within a single task, however, since Web Browser actions are performed interactively (and not in the background), each session must run concurrently and not simultaneously in order to avoid sending interactions to the wrong browser window.

Practical Usage

Used to retrieve URL

Parameters

Browser

Property

Type

Required

Default

Markup

Description

Session name

Text

No

BrowserSession1

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.

NOTE: This action requires

Place session's active URL in variable

Text

Yes

(Empty)

BROWSER="Firefox"

The web browser in which this activity should be performed. The available options are:

  • Internet Explorer - This activity should be performed on an Internet Explorer browser.

  • Firefox - This activity should be performed on Firefox browser.

 

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.

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.

<AMVARIABLE NAME="theURL" />

<AMBROWSER URL="http://www.google.com/" SESSION="BrowserSession2" />

<AMBROWSER ACTIVITY="get_url" SESSION="BrowserSession2" RESULTVARIABLE="theURL" />

<AMSHOWDIALOG WINDOWTITLE="The Active Session's current URL">URL = %theURL%</AMSHOWDIALOG>

<AMBROWSER ACTIVITY="close" SESSION="BrowserSession2" />