Web Browser (Legacy) - Extract source

Declaration

<AMBROWSER ACTIVITY="exsource" SESSION="text" RESULTVARIABLE="text" />

Related Topics        

Description

Extracts an HTML source and places the result in a variable.

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

Used to retrieve the HTML source, which is the web page's raw programming code. You can normally view the source by right clicking on a page and choosing View source.

Parameters

Browser

Property Type Required Default Markup Description
Session name Text Yes BrowserLegacySession1 SESSION="mySession" Specifies the name of an existing session to associate with this activity. Numerous sessions can exist within a single task allowing activities to be performed on several web browsers simultaneously. If working with only one browser, this can remain at the default session name, which is BrowserLegacySession1.
NOTE: Sessions are supported in Internet Explorer and Firefox browsers only.
Store HTML source in Text Yes (Empty) RESULTVARIABLE="myVar" The name of an existing variable in which to populate the  HTML source with.

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 task extracts the source of https://www.helpsystems.com and displays it in a message dialog.

Copy
<AMVARIABLE NAME="theSource" VALUE="" />
<AMBROWSER URL="https://www.helpsystems.com/" SESSION="mySession" />
<AMBROWSER ACTIVITY="exsource" SESSION="mySession" RESULTVARIABLE="theSource" />
<AMSHOWDIALOG>%theSource%</AMSHOWDIALOG>