Web Browser - Create session

Declaration

<AMWEBBROWSER ACTIVITY="attach" SESSION="text" BROWSER="text (options)" BROWSERCLOSE="YES/NO" MATCHWINDOWURL="text" MATCHWINDOWTITLE="text" MATCHWINDOWHANDLE="text" />

Related Topics   

Description

Creates and links a new session to a web browser instance previously opened by Automate. To end a session, use the Web Browser - Close activity.

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.
  • The browser you specify must be updated to the latest version and installed on the target system to ensure the Web Browser action functions correctly.
  • Unlike other session-based actions where sessions are optional, the use of a session in the Web Browser action is required as each created session explicitly links to a specific web browser instance. A session is created using the Web Browser - Create session or Web Browser - Open 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 to avoid sending interactions to the wrong browser window.

Practical Usage

Used to attach a session to an already open browser window matching the specific criteria. To open a web browser, as well as create a session, use the Web Browser - Open activity.

Parameters

Browser

This activity uses Automate's Window Dissection technology to facilitate the discovery of existing windows and their controls. To select certain elements that match an open browser window in which to attach a session to:

  1. Make certain the window is open and in the foreground (that is, in front of all other open windows).
  2. Drag and release the magnifier icon over the window. If the window is supported by this activity, a green border appears around it.
  3. Upon releasing the icon, identified window properties are populated onto the editor.
Property Type Required Default Markup Description
Browser Text (options) Yes Chrome
  • BROWSER="chrome"
  • BROWSER-"edge"
  • BROWSER="firefox"
Specifies the web browser to use with the session. The following browsers are supported:
  • Internet Explorer
  • Chrome (default)
  • Edge
  • Firefox
NOTE: Firefox does not require a separate extension to be installed with this version of the Web Browser action.
Session name Text Yes BrowserSession1 SESSION="mySession" The name of the session to create. A session explicitly links to a specific web browser instance. 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, Chrome, Edge, and Firefox browsers only. Firefox does not require a separate extension to be installed with this version of the Web Browser action.
Close after completion Yes/No No No BROWSERCLOSE="NO" If selected, the web browser window automatically closes after task execution. If disabled, the window remains open after task execution to allow manual work to be performed in the window, if desired. This parameter is disabled by default.
Match by window title Text Yes (Empty) WINDOWTITLE="*Explorer" If enabled, indicates the session is attached to an open browser window matching the specified window handle. If disabled, the window handle is ignored. This parameter supports wildcard characters (for example, * or ?). For example, entering *Automate* includes any browser with the word "Automate" in its handle.
Match by window handle Number No (Empty) WINDOWHANDLE="555735" If enabled, indicates the session is attached to an open browser window matching the handle specified. If disabled, the window handle is ignored. A window handle is numeric code that uniquely identifies an open window. This parameter supports wildcard characters (for example, * or ?).
Match by URL Text No (Empty) URL="555735" If enabled, indicates the session is attached to an open browser window matching the URL specified. This parameter supports wildcard characters (for example, * or ?). For example, entering *Automate* would include any browser displaying the word "Automate" as part of its URL.

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.
  • 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 attaches a session to an existing Internet Explorer browser with the URL https://www.google.com/ and then navigates to www.microsoft.com.

Copy
<AMVARIABLE NAME="theHandle" VALUE="" />
<AMWEBBROWSER URL="https://www.google.com" BROWSER="firefox" SESSION="BrowserSession1" WINDOWHANDLEVARIABLE="theHandle" />
<AMWEBBROWSER ACTIVITY="attach" SESSION="BrowserSession2" BROWSER="firefox" MATCHWINDOWHANDLE="%theHandle%" />
<AMWEBBROWSER ACTIVITY="navigate" SESSION="BrowserSession2" URL="www.microsoft.com" />