How can i calculate the number of rows in a table?


How can i calculate the number of rows in a table ?

The below link shows how to handle web tables and one line counts the rows in the table

How to handle Web Tables | Katalon Docs

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 = Table.findElements(By.tagName('tr'))
'To calculate no of rows In table'
int rows_count = rows_table.size()

Thank you for your reply.
But i can4T find the method FindElement.
I’m using katalon 8.5

you can use this instead

WebUI.findWebElement() keyword acutally wraps WebDriver.findElement() method.

The link I added to your reply had a list of imports statements that I left out. You can always have the statements added automatically by using the key combo: CTRL + SHIFT + O (oh)

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