Web
Browser (Legacy) - Extract source
Declaration
<AMBROWSER ACTIVITY="exsource" SESSION="text" RESULTVARIABLE="text" />
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. |
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 task extracts the source of https://www.fortra.com and displays it in a message dialog.
Copy
<AMVARIABLE NAME="theSource" VALUE="" />
<AMBROWSER URL="https://www.fortra.com/" SESSION="mySession" />
<AMBROWSER ACTIVITY="exsource" SESSION="mySession" RESULTVARIABLE="theSource" />
<AMSHOWDIALOG>%theSource%</AMSHOWDIALOG>