Is it possible to test the sorting functionality of a web table in Katalon Studio?
Does Katalon Studio have any default method to verify whether the datas within a single column is either in ascending or descending order?
The following is the code that I used to fetch all the values listed in the 1st column of a web table and save them in an array:
WebDriver driver = DriverFactory.getWebDriver()
‘To locate table’
WebElement Table = driver.findElement(By.xpath(‘/html[1]/body[1]/table[1]/tbody[1]’))
‘To locate rows of table it will Capture all the rows available in the table’
List rows_table = Table.findElements(By.tagName(‘tr’))
‘To calculate no of rows In table’
int rows_count = rows_table.size()
String celltext = new String[rows_count]
for (int row = 0; row < rows_count; row++) {
‘To locate columns(cells) of that specific row’
List Columns_row = rows_table.get(row).findElements(By.tagName(‘td’))
‘It will retrieve text from 1st cell’
String celltext_1 = Columns_row.get(0).getText()
celltext[row] = celltext_1
}
For example, celltext = [4,3,2,1]
Now I want to verify that the values saved in celltext is in descending order.
Any help will be highly appreciated.