Web Browser - Extract table

Declaration

<AMWEBBROWSER ACTIVITY="extable" PATH="text" HTMLID="text" HTMLNAME="text" HTMLTAG="text" HTMLCONTENTS="text" USEMATCH="number" SESSION="text" BROWSER="text (options)" URL="text" EXTENSIONS="text" IEMODE="YES/NO" RESULTDATASET="text"><HTMLATTRIBUTE NAME="text" VALUE="text" /></AMWEBBROWSER>

Related Topics   

Description

Extracts the contents of a given table in an established session and creates and populates a dataset with the results. The HTML element you specify must be a table, otherwise an error is generated. This activity supports extraction of tabular data. Any HTML in the table’s cells is stripped out. To retrieve or set other elements such as an image or hyperlink, use other activities such as Web Browser - Get value or Web Browser - Set value.

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 extract data from a web browser table. Use the Loop - Dataset activity to call the data in subsequent steps.

Parameters

Location

Property Type Required Default Markup Description
Session name Text Yes BrowserSession1 SESSION="mySession" The name of the existing session to use with this activity. Numerous sessions can exist within a single task which allows several web browser operations to be performed simultaneously on separate browser windows.
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.
Select browser --- --- --- --- You can use Automate's Window Dissection technology to facilitate the discovery of existing windows and their controls.

To select the target browser Automate's Window Dissection technology window:

  1. Open the web browser window and ensure it is in the foreground (that is, in front of all other open windows).

  2. Click, drag, and then drop the magnifier icon over the window. A green border will appear around the window if it is supported by this activity.

  3. After selecting the window, the Browser and URL parameters will populate with the appropriate values.

To manually select the target browser window:

  1. Enter the desired URL in the URL box.

  2. Click Open.

NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes.
Browser Text(options) Yes Chrome
  • BROWSER="chrome"
  • BROWSER="edge"
  • BROWSER="firefox"
Specifies the web browser to use with this activity. 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.
URL Text Yes (Empty) URL="www.google.com" The URL to use with this activity (for example, www.helpsystems.com or https://www.helpsystems.com).
Load extension(s) Text No (Empty) EXTENSIONS="C:\Users\User\Documents\AutoMate 11 Tasks\settings.crx" Specifies the path and file name of the Chromium-based browser extension file(s) (.crx) to load. This can be a fully qualified path and file name, or a single file. Multiple files are specified by clicking the folder icon , and then selecting each desired file, or by manually entering and separating each path and file name with a pipe character (|) (for example, c:\temp\*.crx|c:\backup\*.crx). This parameter becomes available when the Browser parameter is set to Chrome or Edge.
NOTE:
  • Loading an extension file uninstalls and replaces any existing extension file currently in use by the user's profile.
  • Creating a browser session with a user's profile and then loading an extension file into that session will cause additional browser instances (launched manually or in Automate) to also load the same extension file.
Enable IE mode Yes/No No No IEMODE="YES" If selected, enables Internet Explorer (IE) mode which provides legacy support for Internet Explorer-based websites and applications in the Edge browser. This parameter becomes available when the Browser parameter is set to Edge and disabled by default.
IMPORTANT: Before using the Enable IE mode parameter with your tasks, review the Using the Edge Browser with IE Mode Enabled (Enable IE mode) in Automate: Known Limitations and Required Updates and Configurations section.
Locate HTML elements --- --- --- --- The following parameters relate to the specification of HTML elements required to identify the object to use with this activity.

To pinpoint an HTML element (in this case, the button to click):

  1. Enter the desired URL in the URL parameter.

  2. Click Open. The Click (hand) icon becomes enabled.

  3. Click the Click (hand) icon, and then select the desired control in the browser window. If the control is supported by this activity, a blue border appears around it.

To interact with a web page before selecting the desired element, (for example, open a menu to select a menu item):

  1. Hold down the CTRL key on your keyboard, and then click on the web page to navigate to the element.

  2. After locating the element, release the CTRL key, and then click on the element.

Additional parameters become available, based on the element and its properties. You can further fine tune your selection by editing these parameters.

NOTE:
  • This parameter does not support the selection of cross-domain iframes on Edge, Chrome, and Firefox browsers.
  • The overall speed and accuracy of an element search is highly dependent on the contents of an HTML document, as well as the type of criteria being used to search for the element. Using an element's unique ID as a search method is considered the fastest and most accurate method of locating an HTML element because an element ID is always unique within an HTML document.
Path within the document hierarchy Text No (Empty) PATH="/outer/inner/" If the desired control is located within a floating frame, you can specify a frame hierarchy in this field. The specifier is a list of slash delimited frame identifiers (for example, "/outer_frame/inner_framer/").
Locate by identifier (best method) Text No (Empty) HTMLID="unique_ID" If enabled, searches the specified unique ID of the target element. Specifying an element's unique identifier (where supported) is the fastest and most accurate method of locating an HTML element due to the fact that an ID must be unique within the HTML document. This parameter is disabled by default.
Locate by name (certain elements) Text No (Empty) HTMLNAME="element_name" If enabled, specifies the unique name identifying the target object to search. Specifying an element's unique name (where supported) is a fast and accurate method of locating an HTML element as an element name must be unique within the HTML document. This parameter is disabled by default.
Locate by HTML tag Text Yes (Empty) HTMLTAG="tagName" Specifies the start tag (or opening tag) identifying the target object to search.
Locate by attributes (case-sensitive, all must match) --- --- --- --- If enabled, uses attribute name/value pairs as search criteria. Attributes provide additional information about HTML elements. If this option is enabled, the parameters specified below become active. This parameter is disabled by default.
Attribute name Text No (Empty) HTMLATTRIBUTE NAME="foo" VALUE="bar" The name of the attribute to search for. Click Add to enter a new attribute name/value pair. To remove an existing name/value pair, highlight the proper row of data and then click Remove.  
Attribute value Text No (Empty) HTMLATTRIBUTE NAME="foo" VALUE="bar" The value of the attribute to search for. Click Add to enter a new attribute name/value pair. To remove an existing name/value pair, highlight the proper row of data and then click Remove.  
Locate by content (not recommended, slow) Text No (Empty) HTMLCONTENTS="contents" If enabled, uses the specified textual and graphical content between the start and end tags as search criteria. This parameter is disabled by default.
NOTE: This search method is exceedingly slow. It is recommended to only use this method if all other methods are not applicable.
Restrict to specific match Number No (Empty) USEMATCH="44" If enabled, specifies which occurrence to use if there are multiple matches. For example, if five text boxes match and this parameter is set to "4", the activity is applied to the fourth text box. This parameter is disabled by default.

Interaction

Property Type Required Default Markup Description
Create and populate dataset Text Yes (Empty) RESULTDATASET="myDataset" The name of the dataset to create and populate with the extracted table contents. Datasets are accessed in the same way that one would access information in a table; by specifying the column and row where the data resides. Every dataset created and used in Automate must have a unique name, much like variables. But because datasets are more like tables, the unique name of the dataset must be referenced, followed by the column name/number enclosed in percentage signs (for example, %DatasetName.ColumnNumber%). When a dataset is created, the current row is automatically set to 1. To access other rows, use the Loop - Dataset activity.

Description

Error Causes

On Error

Additional Notes

Using the Edge Browser with IE Mode Enabled (Enable IE mode) in Automate: Known Limitations and Required Updates and Configurations

ClosedKnown Limitations

The following are known limitations that can occur while using IE mode with the Edge browser in Automate:

  • IE mode can cause Edge to perform slower and behave differently than other available browsers. Some examples are slower execution times for tasks, or slower response times while using Automate's Window Dissection Technology (magnifier glass) to select HTML elements.

  • Do not manually interact with Edge browser tabs outside of the task. Doing so can cause the task to fail.

  • When the Web Browser - Open activity runs in a task, or if a browser window is opened by another Web Browser activity (for example, using the Web Browser - Click activity to click an Open button), the web browser will first navigate to http://localhost:<random port number>/, and then navigate to the provided URL.

  • Configurable sites have limitations, based on the version of Windows currently running. See the Microsoft doc Learn about Configurable sites in IE mode for more information.

  • Microsoft Edge (with IE mode disabled), Chrome, and Firefox browsers load in Automate without predefined settings and a profile. However, if IE mode is enabled in the Edge browser, it will load the predefined settings of the default profile currently in use with the browser instead.

ClosedRequired Updates and Configurations

The following Microsoft Edge, Internet Explorer, and Windows updates and configurations are required to use IE mode in Automate:

  • Install the latest Windows updates (all supported versions of Windows):

    To ensure the Internet Explorer mode API version in the Edge browser has the latest updates, install the latest Windows updates available to you. After updating Windows, enter edge://compat/iediagnostic in the Edge browser's address bar and confirm the Attempt to launch Internet Explorer mode setting displays Success on the Internet Explorer mode diagnostic information page.

  • Prevent Internet Explorer from opening sites in Microsoft Edge (all supported versions of Windows):

    To ensure IE mode opens web pages in Edge correctly, perform the following steps in the Edge browser:

    1. Start Microsoft Edge.

    2. In the upper-right corner of the browser window, click the Settings and more icon , and then select Settings.

    3. From the navigation pane on the left, select Default browser.

    4. For the Let Internet Explorer open sites in Microsoft Edge, click the drop-down arrow, and then select Never.

  • Disable Protected Mode in Internet Explorer 7 (Windows Vista, Windows 7, and Windows 10):

    Disable the Enable Protected Mode setting for each security zone in Internet Explorer 7. To view and configure this setting for each security zone:

    1. Start Internet Explorer 7.

    2. Click Tools > Internet Options.

    3. Click the Security tab.

    4. Select the Internet zone.

    5. If the Enable Protected Mode (requires restarting Internet Explorer) check box is selected, click it to clear the check box.

    6. Select the Local intranet zone.

    7. If the Enable Protected Mode (requires restarting Internet Explorer) check box is selected, click it to clear the check box.

    8. Select the Trusted sites zone.

    9. If the Enable Protected Mode (requires restarting Internet Explorer) check box is selected, click it to clear the check box.

    10. Select the Restricted sites zone.

    11. If the Enable Protected Mode (requires restarting Internet Explorer) check box is selected, click it to clear the check box.

    12. When finished, click OK.

    13. Exit, and then restart Internet Explorer 7.

  • Disable Enhanced Protected Mode in Internet Explorer 10/Internet Explorer 11 (Windows Vista, Windows 7, and Windows 10):

    Disable the Enable Enhanced Protected Mode setting in Internet Explorer 10/Internet Explorer 11. To view and configure this setting:

    1. Start Internet Explorer 10/Internet Explorer 11.

    2. Select Tools > Internet Options.

    3. Select the Advanced tab.

    4. Scroll down to the Security section.

    5. If the Enable Enhanced Protected Mode check box is selected, click it to clear the check box.

    6. Click OK.

    7. Exit, and then restart Internet Explorer 10/Internet Explorer 11.

  • Adjust display settings (Windows 10):

    Set the Change the size of text, apps, and other items to 100% in Windows 10. To view and configure this setting:

    1. In Windows 10, select Start > Settings > System > Display.

    2. Scroll down the Scale and layout section.

    3. Verify Change the size of text, apps, and other items is set to 100% (Recommended). If it is set to another size, click the drop-down arrow and then select 100% (Recommended).

    4. When finished, exit the Display settings.

  • Disable IE Enhanced Security Configuration setting (all supported versions of Windows Server):

    Disable (Off) the IE Enhanced Security Configuration setting in Windows Server. To view and configure this setting:

    1. In Windows Server, open the Server Manager.

    2. Select Local Server.

    3. If IE Enhanced Security Configuration is set to On, click to configure it, and then proceed to step 4. If it is set to Off, no further configuration is required and you can exit the Server Manager.

    4. On the Internet Explorer Enhanced Security Configuration dialog, set Administrators and Users to Off.

    5. When finished, click OK.

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 web site and then extracts contents from a sample HTML table into a dataset. A message dialog box displays the value of the first column and the first row. The last step closes the web browser, ending the session and completing the task.

Copy
<AMVARIABLE NAME="rowNumber" VALUE="2" />
<AMWEBBROWSER URL="http://www.w3schools.com/html/html_tables.asp" BROWSER="firefox" SESSION="BrowserSession1" />
<AMWEBBROWSER ACTIVITY="extable" HTMLID="customers" HTMLTAG="table" SESSION="BrowserSession1" RESULTDATASET="dsTable" />
<AMSHOWDIALOG>%dsTable(1).Column1%</AMSHOWDIALOG>
<AMWEBBROWSER ACTIVITY="close" SESSION="BrowserSession1" />