Hi, I want to count all the rows in the table but the results are incomplete
kindly check my codes:
'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()
Double due = 0
Double withdraw = 0
String numtext = ""
String rowtext = ""
'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)
//Double withdraw=row
//String total =due-withdraw
'Loop will execute till the last cell of that specific row'
String celltext = Columns_row.get(4).getText()
println("Celltext "+celltext)
if ((celltext != '-') && (celltext.equals('') == false)) {
due = (due + Double.parseDouble(celltext.replace(',', '')))
numtext = numtext +"|"+ celltext;
rowtext = rowtext + "|"+row;
// println(('celltext' + celltext) + ' test')
println('running due: ' + due)
}
//println(numtext)
String totalnetcash = due
//println('total netcash:' + totalnetcash)
WebUI.setText(findTestObject('Single Payment/Page_Core/Netcash'), totalnetcash)
}
println(numtext)
println(rowtext)
The result is they skip the 1-7 rows.