Web Automation

1. Overview #

Clicknium web automation offers support for various popular web browsers such as Chrome, Microsoft Edge, IE, Firefox, Brave, and Vivaldi. To begin recording, you need to install an extension for either  ChromeEdgeFirefoxBrave or Vivaldi .

During recording, When you record a web browser pages, Clicknium will auto detect and choose appropriate web automation to record the element. For Chrome and Edge, Clicknium supports CDP, so that you can use CDP API to run the Python project without browser extension. Browser extension is still required for recording.

2. Locator attributes #

In order to better understand web automation, it’s recommended to start by grasping the concept of  locator. Here are the attributes defined for web automation:

(1). Tab #

NameequalscontainsstartWithendWithregex
NameYesYesYesYesYes
TitleYesYesYesYesYes
URLYesYesYesYesYes
ClassNameYesYesYesYesYes
RoleYesNoNoNoNo
IndexYesNoNoNoNo

(2). Web #

NameequalscontainsstartWithendWithregex
NameYesYesYesYesYes
IdYesYesYesYesYes
TypeYesYesYesYesYes
AncestorIdYesYesYesYesYes
AncestorNameYesYesYesYesYes
CssSelectorYesYesYesYesYes
ClassYesYesYesYesYes
AncestorClassYesYesYesYesYes
SInfoYesYesYesYesYes
TabIndexYesYesYesYesYes
HrefYesYesYesYesYes
SrcYesYesYesYesYes
TitleYesYesYesYesYes
XPathYesNoNoNoNo
TagYesNoNoNoNo
TableRowYesNoNoNoNo
TableColYesNoNoNoNo
IsLeafYesNoNoNoNo
IndexYesNoNoNoNo

3. Locator samples #

  • Azure devops ‘A’ element
<Application processName="chrome" filePath="chrome.exe" version="1.3" />
<Tab className="Chrome_WidgetWin_1" role="window" title="sprint query - Boards" />
<Web ancestorId="row_vss_4_4" tag="A" />
  • Bing search input
<Application processName="msedge" filePath="msedge.exe" version="1.3" />
<Tab className="Chrome_WidgetWin_1" role="window" url="https://*bing.com/" />
<Web id="sb_form_q" name="q" tag="INPUT" />
  • Bing search icon
<Application processName="msedge" filePath="msedge.exe" version="1.3" />
<Tab className="Chrome_WidgetWin_1" role="window" url="https://*bing.com/" />
<Web ancestorId="search_icon" tag="svg" />
  • Bing search result item
<Application processName="msedge" filePath="msedge.exe" version="1.3" />
<Tab className="Chrome_WidgetWin_1" role="window" url="https://*bing.com/search?*" />
<Web ancestorId="b_results" cssSelector="body>div>main>ol>li h2>a" tag="A" />

4. Web element properties #

By using find_element  with a web locator, you can obtain a web element and then retrieve its properties through get_property. Clicknium web elements support the following properties:

NameDescription
pagetitlethe title of the current HTML page
readystatethe loading state of the document, return 1 if Document.readyState equals “complete” or return 0
IDthe unique ID for an HTML element
URLURL of current page
htmlwindownamewindow.name in javascript
titlethe title of an element
cookiethe cookies value, format is cookiename=value, multiple cookies split by ;
innertextthe inner text of an element
innertextshortat most 512 char of innertext
outertextthe outer text of an element
outertextshortat most 512 char of outertext
innerhtmlthe HTML content (inner HTML) of an element
innerhtmlshortat most 512 char of innerhtml
outerhtmlthe HTML elements, including attributes, start tag, and end tag
outerhtmlshortat most 512 char of outerhtml
tagthe tag name of an element
ancestorida Clicknium custom property, the ID of first ancestor node with ID attribute in the DOM tree
ancestornamea Clicknium custom property, the name of the first ancestor node with Name attribute in the DOM tree
ancestorcssa Clicknium custom property, the class of the first ancestor node with Class attribute in the DOM tree
tablerowif the element is in one table, return the row of the element
tablecolif the element is in one table, return the column of the element
rownamerow header name
colnamecolumn header name
columncountcolumn count
rowcountrow count
ischeckedwhether the element(checkbox, radio) is checked
sinfoa clicknium custom property, the text displayed
sinfoshortat most 512 char of sinfo
css_selectorcss selector
classvalue of the HTML class attribute
selecteditemthe text of selected option
selecteditemsthe text of all options
isleafa clicknium custom property, whether the node is leaf in DOM
tabindexthe value of the tabindex attribute of an element
hrefvalue of element’s href attribute
XPathxpath value
Typevalue of element’s type attribute
Srcvalue of element’s src attribute
Rolevalue of element’s role attribute
Namevalue of element’s name attribute
What are your feelings
Updated on 30 November 2023