Web Browser - Close

Declaration

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

Related Topics   

Description

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

NOTE:
  • The Web Browser action is not backwards compatible with the Web Browser (Legacy) action.
  • Automation with the Web Browser action is only compatible with Internet Explorer, Chrome, Edge, and Firefox browsers.
  • You must update the specified browser to the latest version and install it on the target system to ensure the Web Browser action functions correctly.
  • Unlike other session-based actions where sessions are optional, the Web Browser action requires the use of a session as each created session explicitly links to a specific web browser instance (you can create a session using the Web Browser - Create session or Web Browser - Open activity). A single task can support numerous sessions; however, since Web Browser activities are performed interactively (and not in the background), each session must run concurrently to avoid sending interactions to the wrong browser window.

Practical usage

See Description.

Parameters

Browser

Property Type Required Default Markup Description
Session name Text Yes BrowserSession1 SESSION="mySession" The session to close and end all activities linked to it.
NOTE: Sessions are only supported in Internet Explorer, Chrome, Edge, and Firefox browsers.

Description

Error Causes

On Error

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

This sample task opens the 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" VALUE="" />
<AMVARIABLE NAME="theClass" VALUE="" />
<AMVARIABLE NAME="theTitle" VALUE="" />
<AMWEBBROWSER URL="www.google.com" BROWSER="firefox" 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>
<AMWEBBROWSER ACTIVITY="close" SESSION="BrowserSession1" />