To find the least value from the output | Selenium Forum
M
Posted on 02/10/2015
Hi,
i iterated and retrieved set of values(Eg:$15,759.64) from the Web table.

Following are the problems i m facing

1.Values are extracted and at last i m getting "Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 49, Size: 49
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)"

2.How to split the $ sign from it.i used the following code
for(int rownum=2;rownum<=rows.size();rownum++)
{
for(int colnum=1;colnum<=cols.size();colnum++)
{
System.out.println(cols.get(colnum).getText().split("//$",colnum));
}
}
but i m getting the following output
[Ljava.lang.String;@15b6aac
[Ljava.lang.String;@7f959b
[Ljava.lang.String;@3f35f
[Ljava.lang.String;@5afaa6
[Ljava.lang.String;@f3b248

3.How to get the least value from the output.
Please help me on it.

TIA,
nithya.

M
Replied on 03/10/2015

"Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 49, Size: 49"

comes when you are trying to access array number that is not defined.

ex.

Array arr[5];
print(arr[6]);//[color=#FF0000:dqfhkbzi] java.lang.IndexOutOfBoundsException comes here[/color:dqfhkbzi]


M
Replied on 03/10/2015

string splitting there is function you have to use called "substring"

http://www.javatpoint.com/substring