DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • 6 of the Best API Testing Tools in the Market
  • Unmasking Entity-Based Data Masking: Best Practices 2025
  • How Trustworthy Is Big Data?
  • Fixing Common Oracle Database Problems

Trending

  • AI, ML, and Data Science: Shaping the Future of Automation
  • Evolution of Cloud Services for MCP/A2A Protocols in AI Agents
  • It’s Not About Control — It’s About Collaboration Between Architecture and Security
  • Issue and Present Verifiable Credentials With Spring Boot and Android
  1. DZone
  2. Data Engineering
  3. Databases
  4. How to Handle Web Tables in Katalon Studio

How to Handle Web Tables in Katalon Studio

Learn the different aspects of testing a basic web table using the Katalon Studio automated testing framework in this quick tutorial.

By 
Oliver Howard user avatar
Oliver Howard
·
Jan. 03, 18 · Tutorial
Likes (7)
Comment
Save
Tweet
Share
19.0K Views

Join the DZone community and get the full member experience.

Join For Free

Handling web tables is perhaps much more complicated than any other elements or controls. A web table is a collection of rows and columns where data is stored in cells. Tables are used not only in data sheets but also in organizing web pages.

Web Tables

A web table normally contains the following tags:

  •  table – indicates a table.
  •  tbody – defines a container for rows and columns.
  •  tr – specifies a row in the table.
  •  td / th  – table data/table header indicating columns in respective table rows.

A basic web table:

A-Basic-Webtable

A basic web table’s HTML code looks like below:

web-table’s-HTML-code

There are several ways we can handle a web table.

Example 1

You want to get a text from a Web table and verify it.

Scenario: Let’s say we need to find out which country the "Pay talk" company in the above table belongs to.

First of all, we will find the location of the table, then we will store all table elements in the list. Next, we will run a loop and iterate through each row and column and capture the value in each cell.

Script Mode:

import org.openqa.selenium.By as By

import org.openqa.selenium.WebDriver as WebDriver

import org.openqa.selenium.WebElement as WebElement

import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser('D:\\\\Katalon Tutorial\\\\Katalon Tutorial\\\\WebTable_Handling_Scenario1.html')

WebUI.maximizeWindow()

WebDriver driver = DriverFactory.getWebDriver()
'Expected value from Table'
String ExpectedValue = "Pay Talk";
'To locate table'
WebElement Table = driver.findElement(By.xpath("//table/tbody"))
'To locate rows of table it will Capture all the rows available in the table'
List < WebElement > rows_table = Table.findElements(By.tagName('tr'))
'To calculate no of rows In table'
int rows_count = rows_table.size()

'Loop will execute for all the rows of the table'
Loop:
 for (int row = 0; row < rows_count; row++) {
  'To locate columns(cells) of that specific row'
  List < WebElement > Columns_row = rows_table.get(row).findElements(By.tagName('td'))

  'To calculate no of columns(cells) In that specific row'
  int columns_count = Columns_row.size()

  println((('Number of cells In Row ' + row) + ' are ') + columns_count)

  'Loop will execute till the last cell of that specific row'
  for (int column = 0; column < columns_count; column++) {
   'It will retrieve text from each cell'
   String celltext = Columns_row.get(column).getText()

   println((((('Cell Value Of row number ' + row) + ' and column number ') + column) + ' Is ') + celltext)

   'Checking if Cell text is matching with the expected value'
   if (celltext == ExpectedValue) {
    'Getting the Country Name if cell text i.e Company name matches with Expected value'
    println('Text present in row number 3 is: ' + Columns_row.get(2).getText())

    'After getting the Expected value from Table we will Terminate the loop'
    break Loop;
   }
  }
 }


Manual Mode:

Switch to manual mode tab to view the test case step-by-step.

Handle-webtable

Example 2

You want to perform actions on the Web table below:

Web-table

Scenario:

Let’s say we need to edit a student record that has the graduation year of 2018

Script Mode:

import org.openqa.selenium.By as By

import org.openqa.selenium.WebDriver as WebDriver

import org.openqa.selenium.WebElement as WebElement

import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI


WebUI.openBrowser('D:\\\\Katalon Tutorial\\\\Katalon Tutorial\\\\WebTable_Handling_Scenario2.html')


WebUI.maximizeWindow()


'Expected value from Table'
String ExpectedValue = '2018'


WebDriver driver = DriverFactory.getWebDriver()


'To locate table'
WebElement Table = driver.findElement(By.xpath('//table/tbody'))


'To locate rows of table it will Capture all the rows available in the table '
List < WebElement > Rows = Table.findElements(By.tagName('tr'))


println('No. of rows: ' + Rows.size())


'Find a matching text in a table and performing action'


'Loop will execute for all the rows of the table'
table: for (int i = 0; i < Rows.size(); i++) {
 'To locate columns(cells) of that specific row'
 List < WebElement > Cols = Rows.get(i).findElements(By.tagName('td'))


 for (int j = 0; j < Cols.size(); j++) {
  'Verifying the expected text in the each cell'
  if (Cols.get(j).getText().equalsIgnoreCase(ExpectedValue)) {
   'To locate anchor in the expected value matched row to perform action'
   Cols.get(4).findElement(By.tagName('a')).click()


   table: break
  }
 }
}


Manual Mode:

Switch to manual mode tab to view test cases step-by-step.

Handle-webtable-2

Examples above provide a basic understanding of how to handle web tables in Katalon Studio. If you are new to automation testing, it is recommended to take advantage of Manual Mode in Katalon Studio. For advanced testers, Script Mode provides you flexibility in creating and manipulating tests. Please download the source code here.

For further instructions and help, please refer to Katalon Studio Tutorials and Katalon Forum.

Database Katalon Studio

Opinions expressed by DZone contributors are their own.

Related

  • 6 of the Best API Testing Tools in the Market
  • Unmasking Entity-Based Data Masking: Best Practices 2025
  • How Trustworthy Is Big Data?
  • Fixing Common Oracle Database Problems

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!