You are on page 1of 14

A2019 Web Automation Package

Readme

Version 2.0.1
11/03/2021
Table of Contents

1. Introduction ..............................................................................................3
1.1 Overview .............................................................................................3
1.2 Use cases .............................................................................................3
2. Requirements & Prerequisites ...................................................................4
2.1 System Requirements ..........................................................................4
2.2 Prerequisites........................................................................................4
3. Getting Started ..........................................................................................5
3.1 Quick Start ...........................................................................................5
3.1.1 Setup .................................................................................................. 5
3.1.2 Configuration and Use ........................................................................ 5
3.2 Samples .............................................................................................10
4. Support & FAQs .......................................................................................12
4.1 Support..............................................................................................12
4.2 FAQs ..................................................................................................12

Page 2 of 14
1. Introduction
This document contains all essential information for the user to make full use of this A2019
Web Automation Package. It includes a description of the functions and capabilities and step-
by-step procedures for setup & configuration of the A2019 Web Automation Package.

1.1 Overview
The package actions allow to automate tasks in Google Chrome or Microsoft Edge in a high
performance and accurate way using JavaScript code.
It is based on ChromeDriver , EdgeDriver and Selenium
https://chromedriver.chromium.org
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
https://www.selenium.dev/

1.2 Use cases


The key use cases include:
 Automate tasks in web pages that are very dynamic or use HTML elements like
shadowroot
 Build powerful JavaScript based automation
 Automation of tasks in applications such as Salesforce or ServiceNow becomes more
reliable
 Execute automations in “Headless”-mode to make them invisible for end user.

Page 3 of 14
2. Requirements & Prerequisites

2.1 System Requirements


 Enterprise A2019.19+

2.2 Prerequisites
o ChromeDriver 89.0.4389.23 is already included in the package. When you need a
different version, please download it from this web site
 https://chromedriver.chromium.org/downloads

o MSEdgeDriver 89.0.774.50 is already included in the package. When you need a
different version, please download it from this web site
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver

Page 4 of 14
3. Getting Started
3.1 Quick Start
3.1.1 Setup
Import the A2019 Web Automation Package in the Control Room under Bots->Packages

3.1.2 Configuration and Use


The package contains the following command actions

General rules
 All actions with the “JS Script” parameter expect a JavaScript selector that returns one element.
You get these in the Chrome or Edge developer console, Press F12 and then navigate to the
element, right click on it and choose Copy->Copy JS path.
 Actually, It works with every selector that returns one element. You can also copy the XPath of
the selected element and then pass the following script document.evaluate(<XPATH>,
document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue to the JS
Script parameter.
 Never extend the JavaScript code with .value or .click(), because the actions do this.
 The parameter “Wait for Attribute Value” extends the JavaScript code with the value of this
parameter. When you pass “className”, The return value of <Your JavaScript Code>.className
will be checked if it is not null and not empty.
 Create your own JavaScript library and add it to the Start Session action to simplify your code.
See the Sample section for more details.

Page 5 of 14
Name Description Parameter

Start session Start new session Session Name Name of the new session

Browser Execute scripts in an Edge or a Chrome


session

Headless If the Browser window should be visible


or not

WebDriver path Path to a WebDriver executable.


(optional) ChromeDriver 89.0.4389.23 and
MSEdgeDriver 89.0.774.50 are already
included

Existing Remote You can start a Browser session in remote


Session Port debugging mode. When the Browser has
(optional) already started in debugging mode, the
session will reuse this Browser window

Function Library Library of JavaScript functions to make


(optional) coding in the actions simpler

End session End session Session Name Current session

Close Browser If Browser and Driver Session should be


closed or Browser window should stay
open

Open Page Open a new web Session Name Current session


page
URL URL of the web page

Set Value Set Value of an Session Name Current session


element
JS Script Script to be executed to determine the
web element, the action adds “.value” to
the script

Value New value

Timeout How long to wait for the element


(Seconds)

Wait for HTML attribute to be checked if it returns


Attribute Value a value which is not empty and not null

Get Value Get Value of an Session Name Current session


element

Page 6 of 14
JS Script Script to be executed to determine the
web element, the action adds
“var value = "+<your code>+".value; return value “

to the script.

Timeout How long to wait for the element


(Seconds)

Wait for HTML attribute to be checked if it returns


Attribute Value a value which is not empty and not null

Value Return value of the JavaScript code

Get Text Get Text of an Session Name Current session


element
JS Script Script to be executed to determine the
web element, the action adds
“var value = "+<your code>+".innerText; return
value“

to the script.

Timeout How long to wait for the element


(Seconds)

Wait for HTML attribute to be checked if it returns


Attribute Value a value which is not empty and not null

Value Return value of the JavaScript code

Select Select an Element Session Name Current session


Option
JS Script Script to be executed to determine the
web element. The option where the value
equals the parameter value will be
selected.

Value Selected Value

Timeout How long to wait for the element


(Seconds)

Wait for HTML attribute to be checked if it returns


Attribute Value a value which is not empty and not null

Check Check on an Session Name Current session


Element
JS Script Script to be executed to determine the
web element, the action adds “.checked” to
the script

Page 7 of 14
Check True or False

Timeout How long to wait for the element


(Seconds)

Wait for HTML attribute to be checked if it returns


Attribute Value a value which is not empty and not null

Click Click on an Element Session Name Current session

JS Script Script to be executed to determine the


web element, the action adds “.click()” to
the script

Timeout How long to wait for the element


(Seconds)

Wait for HTML attribute to be checked if it returns


Attribute Value a value which is not empty and not null

Submit Submit an Element Session Name Current session


like a Form
JS Script Script to be executed to determine the
web element, the action adds “.submit()” to
the script

Timeout How long to wait for the element


(Seconds)

Wait for HTML attribute to be checked if it returns


Attribute Value a value which is not empty and not null

Focus Focus on an Session Name Current session


Element
JS Script Script to be executed to determine the
web element, the action adds “.focus()” to
the script

Timeout How long to wait for the element


(Seconds)

Wait for HTML attribute to be checked if it returns


Attribute Value a value which is not empty and not null

Execute Execute JavaScript Session Name Current session


JavaScript
JavaScript Code Code to be executed

Value (optional) Return value of the JavaScript code. The


code should end with a “return” statement
to deliver a value.

Page 8 of 14
Wait Element Waits until Element Session Name Current session
Loaded is loaded
Base JS Script Code to be executed

Timeout How long to wait for the element


(Seconds)

Wait for HTML attribute to be checked if it returns


Attribute Value a value which is not empty and not null

Status (optional) True if element has been detected ,


otherwise false

Wait Page Waits until Page is Session Name Current session


Loaded loaded
Timeout How long to wait for the element
(Seconds)

Status (optional) True if page was loaded successfully

Is Page Loaded Checks if Page is Session Name Current session


Loaded
Status True if page loaded without errors

Get Current Get Current Session Session Name Current session


Session ID
Session ID Current WebDriver session ID

Get Current URL Get Current URL of Session Name Current session
the session
URL Current URL of the session

Get Page Source Get Page Source of Session Name Current session
current web Page
HTML HTML source of current page

Page 9 of 14
3.2 Samples

You can use different JavaScript selectors. They should always return one HTML element. Here are some
examples:
document.querySelector("#username")
document.querySelector("#refreshCaptchaImage > img")
document.querySelector("body > dps-app").shadowRoot.querySelector("div > main > dps-home-
unauth").shadowRoot.querySelector("div > div.dps-home-unauth-header > div.dps-home-unauth-header-
copy.behavior-is-in-viewport > dps-link").shadowRoot.querySelector("a")
document.evaluate('/html/body/div[4]/div[1]/section/div[1]/div[1]/one-appnav/div/one-app-nav-
bar/nav/div/one-app-nav-bar-item-root[7]/a', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
null).singleNodeValue

The action “Start session” allows to define a JavaScript library. A library can contain JavaScript functions
that you can use in the JS Script parameter of different actions.
E.g. if you define this library

You can use these functions in actions such as Check, Click, Focus, Select, Get Text, Get Value, Set Value
and Wait Element Loaded

Page 10 of 14
The action Execute JavaScript can be used to run more complex automations, e.g. create a new
Salesforce contact. Please keep in mind that in case your JavaScript code contains a $ sign, you have to
add another $ as an escape character. In the following example we replaced $A.get with $$A.get. You
can parameterize your code using Bot variables, in our case with a record variable “lead”

Page 11 of 14
4. Support & FAQs
4.1 Support
Free bots are not officially supported. You can get access to Community Support through the following
channels:
 You can get access to Community Support, connecting with other Automation Anywhere
customers and developers on– the Bot Building Forum, the Bot Store Support Forum, or the
Developers Everywhere Group.
 Automation Anywhere also provides a Product Documentation portal which can be accessed for
more information about our products and guidance on Enterprise A2019.

4.2 FAQs

You find more information about ChromeDriver, EdgeDriver and JavaScript selectors here
https://chromedriver.chromium.org
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver
https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector

For questions relating to Enterprise A2019: See the Enterprise A2019 FAQs.

Page 12 of 14
Appendix A: Record of Changes.

No. Version Number Date of Change Author Notes

1 1.0.12 23/08/2020 Stefan Karsten Initial version

2 2.0.1 11/03/2021 Stefan Karsten Add MS Edge Support

Page 13 of 14
Appendix B: References

No. Topic Reference Link

1 Overview of Enterprise A2019 Click here


2 Guidance: Building basic A2019 bots Click here

3 Guidance: Building A2019 action packages Click here

4 APeople Community Forum Click here

5 Automation Anywhere University Click here

Page 14 of 14

You might also like