Count total rows

Need help please!

I want to count all rows in the table (30 rows), I can’t handle all rows because of the pagination (10 per page).
So after 10 rows , I get an error…

can you describe test you want to script?

is it not possible to count no. of pages + jump to last page and count rest?

I just want to count all rows in the table, not all visible on the page.

Thank you for answering :slight_smile:

Hello Faly ,

You can look below link , please.

Regards !

Thanking you in advance Emine !

It’s a valuable issue . :+1:

Loop through each page, count the number of rows, and add it to the total:

import com.kms.katalon.core.webui.common.WebUiCommonHelper
import org.openqa.selenium.WebElement

int rowCount = 0;
List<WebElement> pages = WebUiCommonHelper.findWebElements(findTestObject('path/to/pagination/object'), 30);
for(WebElement page : pages) {;
    List<WebElement> rows = WebUiCommonHelper.findWebElements(findTestObject('path/to/rows/object'), 30);
    rowCount += rows.size()

Of course, you would need two Test Objects, one which identifies all of the pagination buttons (1-3 in your original screenshot), and one which identifies all of the rows in the table on any given page.

Otherwise, @Andrej_Podhajsky’s suggestion would work, you would simply count the number of pages in the pagination, subtract one, multiply by the number of results per page, then add the remaining rows from the last page. The only problem with this is that a lot of times paginated tables can be configured to show a certain number of results (Show 10 results per page, 25 results per page, etc.), so the multiply step might not work.

1 Like

OK! I think your thoughts are the best way for me to resolve my problem now @Brandon_Hein

But I will check the view of @Andrej_Podhajsky later because I manage KATALON early.

Thanks guys