I am automating scraping data from a popup contain 542 values such as 12/34, 45/76, 97/23 and so on.
I am trying to print those values on console, then separating and have to display the total of the value before "/" and after "/" such as 12+457+97 and 34+76+23.
My following code is executing and prints the first 10 values, but encounters an error:
"ArrayIndexOutOfBoundsException:1".
The value of listOfActualValues.size()
is showing correct value i.e. 542.
And the below code is to fetch the values from one column, remaining 3 columns are working fine without scrolling down and printing all 542 values.
int sum1=0; int sum2=0; int value1 = 0; int value2 = 0; int finalsum1=0; int finalsum2=0;
for(int av=va+1; av<listOfActualValues.size(); av++)
{
System.out.format("%25s",listOfActualValues.get(av).getText());
String str1 = listOfActualValues.get(av).getText().split("/")[1];
String str2 = listOfActualValues.get(av).getText().split("/")[0];
value1 = Integer.parseInt(str1);
value2 = Integer.parseInt(str2);
}
sum1 =sum1+value1;
sum2 = sum2+value2;
finalsum1 = sum1;
finalsum2 = sum2;
}
System.out.println(finalsum1);
System.out.println(finalsum2);
When i am running same code for another popup which having only 4 values in a single column, its running absolutely correct. Do i need to scroll down using Javascript.
//div[3]/table/tbody/tr[*]/td[contains(text(), '' )][3], it's tag giving me 542 elements td style="width: 100px; color: #333; font-size: 14px; text-align:center;" xpath="2"> 1667/3818