You are on page 1of 11

Web

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). These actions are NOT automatically recorded when you work in browser during recording process.

The main benefits of using Web actions are:

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 Library Actions Description

Open Website
Web Element
Get Value
Set Value
Switch to Browser
How to Get Element XPath
How to Do Table Scraping
Selecting table text using mouse
Selecting table text using Plugins

Open Website
This action launches one of the RPA Express portable browsers (located in RPAExpress\Applications folder) or 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. If the URL is not valid, the browser will perform a search using the default search engine.

There are two ways to define the URL:


explicitly in the URL field;
using Recorder Variables – 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

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.


Firefox Portable - recommended
Chromium Portable (beta)
Internet Explorer
Use Incognito Mode – open the browser in incognito or private mode. This mode is used to reset all cookies, passwords, history, and thus provide
more stability while automating web apps.

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
This action is intended to get/set a web element value (text input, dropdown, label, etc.). Bot searches 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 the How to get XPath section.

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.
If there are more enclosed iframes, you should define all of them 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.

Example
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 Open Website 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 XPath of the element 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 XPath of the element to extract all 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 the How to get XPath section.

Search in iframe(s) – use the option in the same way as described for Get Value.

Switch to Browser
This action activates the browser window (either one of the RPA Express portable browsers or Internet Explorer) previously launched with the Open Website
action. The action has not got any Action specific parameters.
How to Get Element XPath

XPath guide for beginners – Quick XPath Guide

1. Open one of the RPA Express bundled browsers from:


a. RPAExpress\Applications\ChromiumPortable
b. RPAExpress\Applications\FirefoxPortable
2. Right-click the target element in browser page (input field, text label, checkbox)

3. Select the Copy xPath from the context menu.


4. Paste the value from clipboard to the XPath field in RPA Recorder.

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:

Selecting table text using mouse


1. While recording an automation script, drag mouse cursor to select table text.

2. Copy selected text to clipboard (CTRL + C).


3. (optional) When editing the recording, you can set 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)

Selecting table text using Plugins


1. While recording an automation script, open one of the RPA Express bundled browsers from:
a. RPAExpress\Applications\ChromiumPortable
b. RPAExpress\Applications\FirefoxPortable
2. Right-click the target table cell in browser page.
3. Select the Table2Clipboard > Select row / column / table from the context menu.
4. (optional) repeat steps 2 and 3 for other columns and rows if needed. Selected cells will have highlighted borders:

5. Right click and select the Table2Clipboard > Copy selected cells / whole table from the context menu.
6. (optional) When editing the recording, you can set clipboard content to a variable.

You might also like