Web Browser - Open

Declaration

<AMBROWSER URL="text" SESSION="text" WINDOWCLASSVARIABLE="text" WINDOWTITLEVARIABLE="text" WINDOWHANDLEVARIABLE="text" RESULTDATASET="text" />

Related Topics    

Description

Opens a web browser at the specified URL (i.e. http://www.helpsystems.com) and establishes a session in which to correlate subsequent browser related steps. This activity can detect when a webpage is finished loading before moving onto the next step. To end a session, use the Close Browser activity.

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

Commonly used to open a web browser in order to start an automated task that will interact with it.

Parameters

Browser

Property

Type

Required

Default

Markup

Description

Browser

Text (options)

No

Internet Explorer

  1. BROWSER="default"

  2. BROWSER="firefox"

  3. BROWSER="chrome"

  4. BROWSER="safari"

The browser to open. Note that certain browsers do not support automation of other Web Browser related activities. The available options are:

  • Default Browser - Use the default browser specified by your system. Note that selecting this option disables automation, even if the default browser is Firefox or IE. To enable automation, you must select Internet Explorer or Firefox explicitly.  

  • Internet Explorer (Default) - Use Internet Explorer browser.

  • Firefox - Use Firefox browser. Note that Firefox automation requires the AutoMate Firefox Automation Extension which can be downloaded here.

  • Chrome - Use Chrome browser. This browser does not support automation.

  • Safari -  Use Safari browser. This browser does not support automation.

Page URL

Text

Yes

(Empty)

URL="www.google.com"

The URL (Uniform Resource Locator) of the web page to open (i.e.  http://www.networkautomation.com or www.google.com).

Create a new session

Text

No

BrowserSession1

SESSION="MySession"

The name of the session that should be created. A session explicitly links to a specific web browser instance. In order to automate a series of web browser steps,  subsequent activities must be linked to this session. The default session name is BrowserSession1.

NOTE: Sessions are supported in Internet Explorer and Firefox browsers only.

Advanced

Property

Type

Required

Default

Markup

Description

Wait until page is completely loaded

Yes/No

No

Yes

FINISHLOADING="NO"

If set to YES (default), this activity will wait for the web page specified in the Page URL parameter to be completely loaded before continuing to the next step. If set to NO, this activity will continue to the next step without waiting. Set this parameter to YES if the following step requires interaction with the web page.

NOTE: Only supported in Internet Explorer and Firefox browsers.

Populate variable with window class

Text

No

Disabled

WINDOWCLASSVARIABLE="theClass"

If enabled, specifies the name of an existing variable to populate with the window class of the browser window to open. This parameter is disabled by default.

NOTE: Only supported in Internet Explorer and Firefox browsers.

Populate variable with window handle

Text

No

Disabled

WINDOWHANDLEVARIABLE="theHandle"

If enabled, specifies the name of an existing variable to populate with the window handle of the browser window to open. This parameter is disabled by default.

NOTE: Only supported in Internet Explorer and Firefox browsers.

Populate variable with window title

Text

No

Disabled

WINDOWTITLEVARIABLE="theTitle"

 

If enabled, specifies the name of an existing variable to populate with the window title of the browser window to open. This parameter is disabled by default.

NOTE: Only supported in Internet Explorer and Firefox browsers.

Create and populate dataset with window information.

Text

No

Disabled

RESULTDATASET="theDataset"

The dataset to be created and populated with information about the browser window that was opened. The list of dataset fields that this activity creates are entered below under Datasets.

NOTE: Only supported in Internet Explorer and Firefox browsers.

 

Description

Error Causes

On Error

Additional Notes

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the name of the created and assigned dataset is theDataset).

Name

Data Type

Return Value

theDataset.WindowClass

Text

Returns the class of the window that was opened.

theDataset.WindowHandle

Number

Returns the unique handle of the window that was opened.

theDataset.WindowTitle

Text

Returns the title of the window that was opened.

Example

NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description

This sample task opens a browser with www.google.com as the URL and displays the newly opened browser's window title, window handle and window thread in a message dialog. The last step ends the session and closes the web browser.

<AMVARIABLE NAME="theHandle" />

<AMVARIABLE NAME="theClass" />

<AMVARIABLE NAME="theTitle" />

<AMBROWSER URL="www.google.com" SESSION="BrowserSession1" WINDOWCLASSVARIABLE="theClass" WINDOWTITLEVARIABLE="theTitle" WINDOWHANDLEVARIABLE="theHandle" />

<AMSHOWDIALOG WINDOWTITLE="Browser Window Properties">Title of browser window - %theTitle%

Class of browser window - %theClass%

Handle of browser window - %theHandle%</AMSHOWDIALOG>

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