Web Browser (Legacy) - Close |
Declaration
<AMBROWSER ACTIVITY="close" SESSION="text" />
Description
Closes the specified web browser window and ends its associated session.
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
Commonly used to close a browser window and end a session previously started using the Web Browser (Legacy) Create session or Open activity.
Parameters
Browser
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Session name | Text | Yes | BrowserLegacySession1 | 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. |
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
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 class in a message dialog. The last step ends the session and closes the web browser.
Copy
<AMVARIABLE NAME="theHandle" />
<AMVARIABLE NAME="theClass" />
<AMVARIABLE NAME="theTitle" />
<AMBROWSER URL="www.google.com" SESSION="mySession" 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="mySession" />