How to handle Web Tables


This is a companion discussion topic for the original entry at


Nice guide, but every page has a lot of tables and katalon starts to go throw every table. How to get the exactly needed table on the page?I tried the xpath from the table, but i got following massage:
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {“method”:“xpath”,“selector”:"//*[@id=“mainlayoutsubsection”]/table[2]/tbody"}
How can i fix it?


Let me preface with, very new to this, so please excuse my lack of knowledge.

I am trying to test the functionality of a web search tool by verifying the presence of text within rows of a single column within a table. For instance, I need to be able to enter “care” into the search, and verify that all rows of column 1 now display “care”. I will then need to repeat using a different search term for all rows in column 2, etc.

The closest resolution I’ve found is this statement, but I am unable to figure out how to specify a single column.


I just want to get the row index, so i have tried to store it in a variable but it always give me Zero value.


Sorry, it works when change the j to be i thanks.


how to create an edit function in a table on the web without the expectation of a static value. but take a random data to edit?. Please help!


How about if we want to delete data?


Let’s say we need to delete a student record that has the graduation year of 2018, how?


good morning first of all, can someone help me how to get the element of a list sent from a parameter and then that same element is selected?
I have this process that is capturing the element that sent it but does not select it, click on another element.

I hope your support thank you!


[quote=“jquesquen21, post:9, topic:27225”]


The tagName for the edit field is ‘a’ in this case. If you use the Katalon WebUI Spy and capture the ‘delete’ button you can see the specific tagName for the ‘delete’ object and in the code you can just change where it says:

Cols.get(4).findElement(By.tagName(‘a’)).click() to:


and it will click the delete object for you.


i am working on application where i need to submit 100s of forms consists of 80-90 questions. every form will have different set of answers.

i have created switch statements for each question.

is there any way i can shorten the script, otherwise i have to create one switch statement for every question and one case statement for each answer.

Two excel sheets looks like for your reference as:

Question sheet (Static) looks like:
Question 1 Question 2
Answer A Answer A
Answer B Answer B
Answer C

Answer Sheet looks like:
Form Number Question1_Answer Question2_Answer
Form1 Answer B Answer B
Form2 Answer A Answer C
Form3 Answer A Answer A
(i iterated this through test suite data binding)
Switch statement I created as:

switch (Question1_Answer) {
case findTestData(‘Question_Sheet’).getValue(1, 1):‘A’))

case findTestData('Question_Sheet').getValue(1, 2):'B'))



switch (Question2_Answer) {
case findTestData(‘Question_Sheet’).getValue(2, 1):
Run_Time_Object = WebUI.modifyObjectProperty(findTestObject(‘A’), ‘id’, ‘equals’,
findTestData(‘Object ID Data’).getValue(3, 1), true)

case findTestData('Question_Sheet').getValue(2, 2):
    Run_Time_Object = WebUI.modifyObjectProperty(findTestObject('A'), 'id', 'equals', 
        findTestData('Object ID Data').getValue(4, 1), true)


case findTestData(‘Question_Sheet’).getValue(2, 3):
Run_Time_Object = WebUI.modifyObjectProperty(findTestObject(‘A’), ‘id’, ‘equals’,
findTestData(‘Object ID Data’).getValue(5, 1), true)

How can i create a loop so that i don’t need to create switch statement for each question?
Plz consider both columns and rows incremented…


hello all, @h.bevis I wish if you can help me.
I’m working on the dynamics 365 web table, and I’m not able to select the first row in the web table. any idea how can solve this problem


In the code above, you should be able to get the first row of a table by:

‘Loop will execute for all the rows of the table’
for (int irow = 0; irow < rows_count; irow++)
‘To locate columns(cells) of that specific row’
Columns_row = rows_table.get(irow).findElements(By.tagName(‘td’));

However, I often put a wait statement, such as waitForElementVisible(To, 10) before trying to find the table element, such as:

‘delay until first row of table shows’
WebUI.waitForElementVisible(findTestObject(‘td_Table Row 1’), 10)
‘To locate table’
Table = driver.findElement(By.xpath("//table/tbody"));


If I can suggest for you to put in either a println(table.get(j).getText()) or a WebUI.verifyMatch(table.get(j).getText(), ExpectedValue, false) after the FOR statement and before the IF statement to see what are the different values (the verifyMatch displays both texts in its log output). The difference may be the addition of only a period at the end, but that is enough to cause a failure.


@dmitri.voronin Change the XPath so that, with an ID, you should use:


something other than an ID, then use the double slashes at the start.

Also, it is often beneficial to put a waitForElementVisible to allow the table to form before checking the table elements.


While this is a nice guide, I do take issue with the “store all elements in a list, then iterate and do action x” approach in general. This has two glaring issues:

1.) Depending on the size of the table, and the number of elements the script writer actually cares about validating/manipulating, then getting every element of a table and storing them in a list might be unnecessarily expensive. What if I only care about one particular cell at any given moment?

2.) An even bigger problem is that this approach has a high risk of throwing a StaleElementException. After you build a list of elements, if the DOM changes in any way (page reload, async js function, etc), then your list will almost certainly contain stale elements, in which case you would need to rebuild the list anyway to account for it (which is just problem #1 again).

In my opinion, it’s much more efficient as well as less risky to provide a locator that takes row/column indeces as arguments, and locate individual table elements at the moment they are needed. This way you are only every parsing the DOM for a single element, and the chance that that one element will become stale is drastically reduced.