Turn your manual testers into automation experts! Request a DemoStart testRigor Free

How to reference elements by UI position using testRigor?

When referring to an element in the DOM, testRigor never relies on unstable XPaths, and it uses testRigor locators instead. XPaths can change when the element property or hierarchy changes, leading to false positive bugs. So, testRigor references the element using its display name on the screen (text that you see)or the UI position. So today, we will check how testRigor refers to elements in plain English text.

testRigor uses around twenty-five supported positions for referencing UI elements, so let’s go into detail.

Setting up test Suite

Step 1: Log in to your testRigor app with your credentials.

Step 2: Set up the test suite for the website testing by providing the information below:

  • Test Suite Name: Provide a relevant and self-explanatory name.
  • Type of testing: Select from the following options: Desktop Web Testing, Mobile Web Testing, Native, and Hybrid Mobile, based on your test requirements.
  • URL to run test on: Provide the application URL you want to test.
  • Testing credentials for your web/mobile app to test functionality which requires user to login: You can provide the app’s user login credentials here and need not write them separately in the test steps then. The login functionality will be taken care of automatically using the keyword login. However, this is an optional field and can be skipped if not relevant.
  • OS and Browser: Choose the OS Browser combination on which you want to run the test cases.
  • Number of test cases to generate using AI: You can simplify your test creation further by opting to generate test cases based on the App Description text. This feature works on generative AI.

Step 3: Click on Create Test Suite.

  • On the next screen, you can let AI generate the test case based on the app description you provided while creating the Test Suite. However, for now, select do not generate any test, since we will write the test steps ourselves.

Step 4: To create a new custom test case, click Add Custom Test Case.

Step 5: Provide the test case Description and add the test steps.

Test Steps: Element Reference by UI Position

Scenario 1: In the middle of the screen

When we have a scenario where the element is in the middle of the screen, we can mention it as:
click "See case studies" in the middle of the screen

Scenario 2: In the top quarter of the screen

For clicking an element that is present in the top quarter of the screen, we can write as:
click on the link "Case Studies" in the top quarter of the screen
Also, if you just want to click on the top quarter of the screen, mention:
click in the top quarter of the screen

Scenario 3: In the second top quarter of the screen

For clicking in the second top quarter of the screen, mention:
click in the second top quarter of the screen.
To click any element in the top quarter of the screen, we can write like:
click "Why testRigor?"
click the link "Start testRigor Free" in the second top quarter of the screen

Scenario 4: In the bottom quarter of the screen

For clicking in the bottom quarter of the screen, mention:
click in the bottom quarter of the screen
For clicking an element in the bottom quarter of the screen, we can write as:
click "Sign Up".
click the link "Start Free Trial" in the bottom quarter of the screen

Scenario 5: In the second bottom quarter of the screen

We can click in the second bottom quarter of the screen; for that, the test script will be:
click in the second bottom quarter of the screen
For clicking any element in the second bottom quarter of the screen:
click the link "Start testRigor Free" in the second bottom quarter of the screen

Scenario 6: In the top third of the screen

To click on the top third of the screen, the script will be:
click in the top third of the screen
For clicking an element in the top third of the screen, we can write as:
click the link "Login" in the top third of the screen

Scenario 7: In the bottom third of the screen

Similarly, when clicking on the bottom third of the screen, we can write as:
click in the bottom third of the screen
When a user needs to click an element in the bottom third of the screen, the test script will be:
click "Sign Up"
click the link "Get Started" in the bottom third of the screen

Scenario 8: In the left quarter of the screen

For clicking the left quarter of the screen, the test script will be:
click in the left quarter of the screen
We can click any element in the left quarter of the screen, for example:
click the link "Join" in the left quarter of the screen

Scenario 9: In the second left quarter of the screen

To click on the second left quarter of the screen, we can write as:
click in the second left quarter of the screen
To click an element that is in the second left quarter of the screen, we can try with below example:
click the link "Start testRigor Free" in the second left quarter of the screen

Scenario 10: In the right quarter of the screen

For clicking the right quarter of the screen, we can write the test script as:
click in the right quarter of the screen
We can click an element that is on the right quarter of the screen, like:
click the link "End-To-End Testing" in the right quarter of the screen

Scenario 11: In the second right quarter of the screen

The test script for clicking in the second right corner of the screen will be:
click in the second right quarter of the screen
To click an element in the second right corner of the screen will be:
click the link "Become Partner" in the second right quarter of the screen

Scenario 12: In the left third of the screen

To click on the left third of the screen, we can write as:
click in the left third of the screen
For example, we can click an element on the left third of the screen with the test script as:
click the link "Get Started" in the left third of the screen

Scenario 13: In the right third of the screen

For clicking on the right third of the screen, we can create the test script:
click in the right third of the screen
For clicking an element on the right third of the screen, we can create the test script:
click the link "Request a Demo" in the right third of the screen

Scenario 14: In the left side of the screen

If you need to click in the left side of the screen, the test script will be:
click in the left side of the screen
For clicking the element in the left side of the screen, the test script will be:
click the link "Why testRigor?" in the left side of the screen

Scenario 15: In the right side of the screen

Test script for clicking in the right side of the screen will be:
click in the right side of the screen
For clicking an element in the right side of the screen will be:
click the link "Login" in the right side of the screen

Scenario 16: In the top of the screen

To click in the top of the screen, the test script will be:
click in the top of the screen
Also, to click an element at the top of the screen, we can write it as:
click the link "Login" in the top of the screen

Scenario 17: In the bottom of the screen

For clicking at the bottom of the screen, the test script will be:
click in the bottom of the screen
For clicking an element at the bottom of the screen, we can write the test script as:
click the link "See case studies" in the bottom of the screen

Scenario 18: In the left edge of the screen

To click on the left edge of the screen, the sample test script will be like this:
click in the left edge of the screen

Scenario 19: In the right edge of the screen

For clicking at the right edge of the screen, the test script will be like this:
click in the right edge of the screen

Scenario 20: In the top edge of the screen

For clicking at the top edge of the screen, the test script will be:
click in the top edge of the screen

Scenario 21: In the bottom edge of the screen

For clicking at the bottom edge of the screen, the test script will be:
click in the bottom edge of the screen
One more method of specifying the position on the screen method is also supported by testRigor, but it is highly discouraged (for stability reasons); for example:
click on "Delete" with offset "20,10"

Note: Offset is calculated from the element’s top left corner, with the horizontal coordinate first.

Execution Results

Once the test is executed, you can view the execution details, such as execution status, time spent in execution, screenshots, error messages, logs, video recordings of the test execution, etc. Logs and error text are available easily in case of failure in a few clicks.

You can also download the complete execution with steps and screenshots in PDF or Word format through the ‘View Execution‘ option.

testRigor’s Capabilities

Apart from the simplistic test case design and execution, some advanced features help you test your application using simple English commands.

  • Reusable Rules (Subroutines): You can easily create functions for the test steps you use repeatedly. You can use the Reusable Rules to create such functions and call them in test cases by simply writing their names. See the example of Reusable Rules.
  • Global Variables and Data Sets: You can import data from external files or create your own global variables and data sets in testRigor for data-driven testing.
  • 2FA, QR Code, and Captcha Resolution: testRigor efficiently manages the 2FA, QR Code, and Captcha resolution through simple English commands.
  • Email, Phone Call, and SMS Testing: Use simple English commands to test the email, phone calls, and SMS. These commands help validate 2FA scenarios with OTPs and authentication codes sent via email, phone calls, or text.
  • File Upload/ Download Testing: Execute the test steps involving file download or file upload without the requirement of any third-party software. You can also validate the contents of the files using testRigor’s simple English commands.
  • Database Testing: Execute database queries and validate the results fetched.

testRigor enables you to test web, mobile (hybrid, native), API, and desktop apps with minimum effort and maintenance.

Additional Resources

You're 15 Minutes Away From Automated Test Maintenance and Fewer Bugs in Production
Simply fill out your information and create your first test suite in seconds, with AI to help you do it easily and quickly.
Achieve More Than 90% Test Automation
Step by Step Walkthroughs and Help
14 Day Free Trial, Cancel Anytime
“We spent so much time on maintenance when using Selenium, and we spend nearly zero time with maintenance using testRigor.”
Keith Powe VP Of Engineering - IDT
Related Articles

How to Create Tests Using Live Mode in testRigor?

testRigor offers a unique capability known as the ‘Live Mode‘ to create and validate test cases. Using it, you can ...

How to Automate Web Testing with testRigor

Web testing plays a crucial role in the software development lifecycle, allowing web applications to function correctly, provide ...
On our website, we utilize cookies to ensure that your browsing experience is tailored to your preferences and needs. By clicking "Accept," you agree to the use of all cookies. Learn more.
Cookie settings
Privacy Overview
This site utilizes cookies to enhance your browsing experience. Among these, essential cookies are stored on your browser as they are necessary for ...
Read more
Strictly Necessary CookiesAlways Enabled
Essential cookies are crucial for the proper functioning and security of the website.
Non-NecessaryEnabled
Cookies that are not essential for the website's functionality but are employed to gather additional data. You can choose to opt out by using this toggle switch. These cookies gather data for analytics and performance tracking purposes.