Click / Drag / Hover


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

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: Parameters of all commands by default are not 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 button “a” in a web application, you can type:
click "a"
In a mobile application, you can use tap instead of click:
tap "a"

However, click works if you’d like to reuse the same steps across web and mobile applications. Read more about click commands here.

Click with relative location

In general, testRigor does an excellent job identifying elements by its name or the text it contains as it appears on the screen; however, in some cases (e.g., when there are multiple instances of the same element on the screen), you will need to specify a relative location to provide a better context to identify it.
click "Read The Story" to the left of "Release Manager – Edcast"
It’s not unusual for a website nowadays to have multiple focus areas (also known as containers and divs) on the same page. Use the relative location in the context of to target an element inside such an area:
click "Request a demo" in the context of "menu"
testRigor also allows the use of multiple relative locations in a single command:

click the input completely below "Additional Data" and on the right of "Nyota"
Read more about relative locations here.

Clicking with a mouse vs. using JavaScript

Many elements of a website are not alone but are encased inside areas or containers as mentioned above. These containers (known as divs in HTML) organize elements in layers. JavaScript clicks can target an individual layer while mouse clicks target the entire object like humans do. The default mode is JavaScript. Since Javascript does not have to move the mouse to click on the element, it saves a few milliseconds, which can add up when cases have a lot of steps.

Despite JavaScript clicks being faster, mouse clicks are necessary in some cases. One such situation is when clicking on any non UI element. This usually comes in the form of browser popups asking for location, camera, or microphone permissions.

Some applications also prefer browser popups to UI popups for confirmation of actions performed in the UI.

Another case is when working with canvas-based platforms like Flutter or with text that is inside an image or canvas. For all scenarios requiring mouse clicks, these elements are found using OCR only. JavaScript clicks need the text to be in the DOM to locate it, but when the text is only in the image, OCR is the only option.

The default setting for click types can be changed, and it is possible to specify in test case steps where a click type opposite of the default is necessary.


click "Allow" using OCR only using the mouse

Note: In headless (browser-less) mode, there are no visible UI elements. This means that clicking with JavaScript is the only option. If your test cases require using the mouse, do not enable headless mode.

Click by index

As a rule of thumb, relative locations are preferred over indexes. However, in some cases, referring to the item by its iteration on the screen (1st, 2nd, 3rd) 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" in the section "Section 1"

Middle click and double click

The middle click feature was added to allow users to automatically open a link in a new tab.
middle click "here" on the right of "See more information"
Double click allows you to select or highlight a word that you need to perform an action on (such as copy, delete, drag, etc):
double click "username"

Right click

Different applications use right clicks for different purposes. For example, some prompt a browser default pop-up that will provide extra options, but others may prompt a custom menu of options like when you right click a test suite name on testRigor’s homepage. Furthermore, the type of item (link, button, text, video, blank area) will produce a different list of options.
right click "filename"

Click on specific coordinates

It is also possible to click on a specific coordinate relative to an entire page element or to a single element on a page. This is rarely recommended due to stability issues that may arise; however, clicking by coordinate (or offset) relative to an element is always more stable than doing so relative to the entire page. This is especially true in situations where coordinates are the only realistic option for interacting with a UI, such as when working with elements on a canvas (an area on a page or an entire page where the elements added usually do not appear in HTML and have no independent locators or properties by which they can be identified. Text elements might be identified by OCR, but the coordinate is essentially the only option for elements without text).
click "canvas" with offset "20,10"

The offset is calculated from the top left corner of the element/page to the bottom right. The first number is the horizontal coordinate. The higher the number, the further to the right the coordinate will be. The second number is the vertical coordinate. The higher the number, the further down the coordinate will be.

Offsets can also be used with other commands, such as drag and zoom.


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

As mentioned in the section immediately above, the drag command can be used with coordinates. Even better, users can drag to multiple points to create shapes.
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"


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.

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

Test your knowledge

It is best to use the mouse to click while in headless mode.
Clicking on a button in a browser popup using JavaScript will not work.
testRigor cannot recognize partial strings when used to click on a button.
testRigor always requires exact case sensitivity to identify elements.
(a) tap “a”
(b) click “a”
(c) touch “a”
(d) press “a”
(e) options a, b, and c
(f) options a, b, and d
(g) options a, c, and d
drag file from stored value “file” from “directory” into “element”
drag “localDirectoryLocation” into “droppable file section”
drag file “<URL>” onto “element”
push file “<URL>” onto “element”
click 2nd “Filename”
click 2nd “Filename” in context of double click
click 2nd “Filename” double times
double click 2nd “Filename”
[wpcode id=”1112380″ answers=”2;6;3;4″ page=”Clicks / Drag / Hover” numoffields=”4″]