Certification: AI-driven Test Automation

Clicks

Clicks

This is a base command. In this section we will explore different types of clicks that you can use in testRigor

Example:
enter "doll" into "search"
click "search"

testRigor is smart enough to understand that the first “search” refers to an input whereas the second one refers to a button.

Note: All parameters of all commands by default are case insensitive and will find the element even if they match partially

For example:
click "search"
Will click on the same button as
click "Search"
To click on the button “a” in a web application you can type:
click "a"
In a mobile application, use “tap” instead of “click”:
tap "a"

You could use clicks to do taps if you’d like to reuse the same steps across web and mobile applications

Clicks with relative location

In general, testRigor does a really good job identifying elements based solely on name, however, in some cases (ex: if the test fails) you should specify a relative location to provide a better context of where to look for this element.
click "Read The Story" to the left of "Release Manager – Edcast"
It’s not unusual for a website nowadays to have multiple focus areas on the same page. Use “in the context of” command to specify such area:
click "chrome" in the context of "Pixel 3XL"
A couple of other examples. Notice the flexibility as well as the ability to group multiple commands together:
click on "All" to the left of "Best sellers"
click on the button "Best Sellers" to the right of the button "All"

Clicking with a mouse vs. using JavaScript

The default mode is JavaScript

Note: in headless mode, clicking with JavaScript becomes the only option. If your test cases require clicking via mouse, use regular (non-headless) mode.

Clicks by index

As a rule of thumb, it’s always better to use relative locations other than indexes. However, in some cases, indexes might be necessary.

Sometimes there will be multiple elements with the same title on the page, for example multiple “Add to cart” buttons. You can reference them via a number, like so:
click on the 3rd "Add to cart"
Remember how there might be multiple focus areas on the page? You can easily combine indexes with relative locations:
click on the second "Add to Cart" within the context of "Section 1"
It’s important to understand the concept that:

click on 1st "Add to cart" is not the same as click "Add to cart"

This is because all elements have different priorities. testRigor uses OCR (Object Character Recognition) feature and assigns priorities to all elements. For example, if there are 3 “Add to cart” buttons on the page, and you scroll down to the end of the page where only the third “Add to cart” is visible – testRigor will assign the highest priority to this button.

Q: For the example above, what are 2 ways to make testRigor click on the “Add to cart” button?

Drags

testRigor supports drag and drop for elements and files. Use “drag onto” command
drag "text1" onto "text2"
drag file "<URL>" onto "element"
drag file from saved value "File to upload" onto "element"
If you need to drag a folder with files, you need to zip it and upload in the Test Data section and use it like so:
drag folder from saved value "Zipped Folder" onto "element"
Note: in headless mode, the above might not work – therefore you need to specify action done with the mouse
drag "text1" into "text2" with the mouse
drag "link to file" into "droppable file section"

Alternatively, you can specify everything done with the mouse in the settings section. Settings > Advanced > in the Desktop Web Fine Tuning section How to process clicks > Use OS Mouse

Middle clicks and double clicks

Example of middle click:
middle click on the 3rd "hello"

Note: you can use middle clicks to open a link in a new tab

Similarly, you can use double click to highlight selected text:
double click on "username"

Right clicks

Example of right click:
right click on "filename"

Note: depending on where you click, the action may trigger a specific application UI or it might initiate built-in browser commands, just as when using a regular mouse.

Clicks with an offset

It is also possible to click on a specific part of an element with an offset (however this is not recommended due to stability reasons). Example:
click on "Delete" with offset "20,10"

The offset is calculated from the top left corner of the element, horizontal coordinate first.

Offsets can also be used with other commands, such as drag, zoom in and zoom out, pinch open and pinch close.

For example, here’s how offsets can be used to draw on a canvas by dragging mouse to multiple points without releasing the click:
drag "canvas1" with offset "0,0" to "canvas1" with offset "50,0" via "canvas1" with offset "0,50" through "canvas1" with offset "50,50"

Hover

You can use a hover command in testRigor the same way as when using a regular mouse. Use it to trigger specific UI actions where needed.

Example:
hover over "Account & Lists"
click "My account"

Test your knowledge

testRigor will always consider “search” as a button.
testRigor interprets “search” based on context, distinguishing between input and button elements.
testRigor will only consider “search” as an input field.
testRigor requires exact capitalization to identify elements.

tap “a”
click “a”
touch “a”
press “a”

drag “file URL” into “element”
drag “link to file” into “droppable file section”
drag file “<URL>” onto “element”
push file “<URL>” onto “element”

click on the 2nd “Filename”
click on the 2nd “Filename” in context of double click
click on the 2nd “Filename” double times
double click on the 2nd “Filename”