Web Browser - Close

Declaration

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

Related Topics    

Description

Closes the specified web browser window and ends its associated session. Use the

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 close a browser window and end a session previously started using the Web Browser - Open activity or Web Browser - Create session activity.

Parameters

Browser

Property

Type

Required

Default

Markup

Description

Session Name

Text

Yes

BrowserSession1

SESSION="mySession"

The name of the session to close. Closing a session ends all activities linked to that session.

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

 

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

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" />