Skip to end of metadata
Go to start of metadata

The Web action group is intended for automating browser actions, such as open website in browser, get value, and set value of a web element (text input, dropdown, etc). These actions are NOT automatically recorded when you work in browser during recording process.

The main benefits of using Web actions are as follows.

  • Stability – system actions are more reliable and quicker than image-based ones.
  • Less actions needed
    • Open website: click browser icon or start menu > click on address line > type website URL > hit Enter
    • Get web element value: find element by image > select text by double-click or drag > copy to clipboard > set clipboard to variable
  • Launch options – you can set browser type, private mode, element locator (XPath), etc.
  • Readability – even new users will understand the action flow at first glance.
Actions LibraryActions Description

Sample recording

This sample recording demonstrates how you can use web actions to automate work with websites and web applications.

To run it, you need to:

  • download and unzip the recording folder
  • copy the folder to your workspace (default location is C:\Users\%USERNAME%\workfusion-workspace\rpae_project)
  • refresh the Media Files tab in RPA Recorder and open web-automation-example.rpae file

Open Website

The action launches one of the supported browsers (Chrome, Firefox, and Internet Explorer) and opens a specified website.

The Open Website action can contain other actions (Web Element, Mouse, Keyboard actions, etc.) as its children – just drag them onto the Open Website action.

Parameters

  • Site URL – the address of the website that will be opened.
    There are two ways to define the URL:
    • explicitly in the URL field;
    • Recorder Variable – the variable should be declared as String.

      Attention

      The URL in the Recorder variable should be defined as:

      http://www.site_address

      or

      https://www.site_address

      Tip

      If you need to open a website that uses Basic authentication, you need to pass credentials via the URL, e.g.:

      http(s)://login:password@site_address


      In this way, you have a lot of options to create a URL using Text Actions (for example Join), Loops, Clipboard, and other actions.

  • Browser – select the browser to use when opening the website.

Attention

The Use Incognito Mode option is currently not available and is disabled by default.

With the Open Website action, you can use the Mouse Click by XPath action. Refer to the Mouse Actions section for more details.

Web Element

The action is intended to get/set a web element value (text input, dropdown, label, etc.). Bot searches for a web element by its unique locator called XPath which is more reliable than image in most cases.

Get Value

This action performs the following: find element by XPath > select element text > set this text to a variable.

Parameters

  • Get value / Set value – choose whether to read a value from a text field/checkbox/other element on a page, or write a value to an element on a page.
  • XPath of the element – indicate the element by specifying its unique locator called XPath. See XPath Guide for more information.
  • Search in iframe(s) – use the option, if the element you need to get data from is located in an iframe (or iframes) as shown on the image below.

Note

The iframe containing the web element can be enclosed in another iframe. In this case you should define each iframe separately.

For this purpose click Add and define the iframe, which holds the iframe with the web element.

When defining the iframes you should keep the following order:

  1. The first iframe – the iframe containing the web element.
  2. The second iframe – the parent iframe where the previous iframe is enclosed to.
  3. The third / fourth / fifth / etc. iframes should be defined all one by one so as the root iframe is on the last place.
  • Use element attribute – define an attribute of the web element to be searched by XPath, for example href, class, id, src.
 See use case

In the example, we will collect all links from a div element located in an iframe.

Open https://www.w3schools.com/html/html_iframe.asp with the Open Website action and add Web Element to choose the elements required.

  1. In XPath of the element define XPath to the elements (links) for extraction (defined as a Recorder variable ${linksinframe} whose value is //div[contains(@class, 'w3-col l10 m12')]//a).
  2. Select the Search in iframe(-s) option. Define the iframe, where the div element is located. In the XPath of parent iframe(-s) field define the target iframe (defined as ${iframe} whose value is //iframe[contains(@height, '310px')]).
  3. Define the element attribute to narrow the search. Select the Use element attribute option and define the attribute (defined as ${attr} whose value is href).
  4. Select a variable to save the output (defined as linksres of List type as there can be a number of links in the div, that match the defined criteria).
  • Save value to variable – the value of the indicated element will be saved to this variable.

There are two options for extraction provided by the function.

  • Get a single element, when you define the XPath explicitly and save the result to a String or Number variable.

    Example

    1. Open www.sec.gov with Open Website
    2. Put //*[@id="header-nav"]/li[1]/a in the element XPath to define the element for extraction explicitly (the first item from the list).
    3. Save value to a String or Number variable.
    4. Play the recording.
    5. Check the value in the output. Result – "ABOUT". The single element has been extracted by XPath.
  • Get a list of elements, containing under a single XPath and save the result to a List variable.

    Example

    1. Open www.sec.gov with Open Website
    2. Put //*[@id="header-nav"]/li/a in the element XPath to extract all the elements by XPath (all items from the list).
    3. Save value to a List variable.
    4. Play the recording.
    5. Check the value in the output. Result – "[""ABOUT"",""DIVISIONS"",""ENFORCEMENT"",""REGULATION"",""EDUCATION"",""FILINGS"",""NEWS""]". A collection of elements has been extracted by XPath.

Set Value

 This action performs the following: find element by XPath > get text from recorder variable > set this text to the web element.

Parameters

  • Use value from variable – the value of the indicated element will be set from the value of this variable.
  • XPath of the element – indicate the element by specifying its unique locator called XPath. See XPath Guide for more information.
  • Search in iframe(s) – use the option in the same way as described for Get Value.

Switch to Browser

The action activates the browser window (Chrome, Firefox or Internet Explorer) previously launched with the Open Website action. The action has not got any action specific parameters.

Mind that the Switch to browser action is used only if the Open Website action has already been added to the flow.

How to Get Element XPath

Read how to get a web element's XPath in different browsers in XPath Guide.

How to Do Table Scraping

Table scraping is one of the valuable automation use cases. For example, users want to automate copying text from a web page table and paste it to an Excel file for further manipulations.

Scraping can be done in the following ways.

  1. While recording an automation script, drag the mouse cursor to select the table text.
  2. Copy the selected text to the clipboard (CTRL + C).
  3. (optional) When editing the recording, you can set the clipboard content to a variable.

Disadvantages

  • Cannot select separate column(s)
  • Hard to set selection when table text changes (need to set anchor images for top-left and bottom-right table corners)

For more details, see our Table Scraping sample.

  • No labels