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

How to Automate Testing Tables

How to automate testing tables

When automating tables you want to make sure you use the most stable and the easiest way to do it.

Specifically, there are two most reliable ways to do it:
  1. When working with tables rely on relative locations
  2. When working with tables rely on table structure from an end-user’s perspective
For example, if we are to delete a row in a table described here:
# Id Name Actions Additional Data
Filter by
101 york1 Yorktown
102 spk2 Spock
103 nyo3 Nyota

by clicking on the “delete” button on the row with the unique id “spk2”

We can express clicking on the button using relative location in testRigor like this:
click on the second button to the right of "spk2"
Or, we can use table language to express the context where to find the buttons like this:
click on the second button within the context of table at row containing "spk2" and column "Action"

Both ways would work even if the rendering of the table change from table-based rendering to div-based rendering like this one.

Compare it with a way of doing it in Selenium: you’d have to build an XPath to locate the element, that in the case of the first table you’ll build the XPath like this:
//table/tbody/tr[td[text()="spk2"]]/td[3]/a[2]
however, it will fail if engineers would migrate to a library that renders the table using divs like so. And the XPath will not only change dramatically like so:
//*[@id="table3"]/div/div/div/div/div[2]/div[2]/div[4]/a[2]

but also, there is barely any reliable way to refer to that element using XPath at all.

Here is a video walking through step by step how to do it:

Would you like to try it yourself?

You can get a forever free account here.

Related Articles

Test Plan Template

“Plan your work and work your plan” — Napoleon Hill. This philosophy holds even in software testing. Of the many artifacts ...

Natural Language Processing for Software Testing

The ways we communicate with technology today are quite different from what they used to be. From asking Siri about the weather ...
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.