Module 15 , get the player name who scrored maximum | Selenium Forum
Posted on 22/08/2015
Hi Team,
How to get the player name who scored maximum.

Here in below code i am able to get individual score and converted into integer from string.
Now i need to compare the each score and get the maximum score . In order to do so i hope i need to pass the integer to Array. But i am not sure how to do so.Pls help me

List<WebElement> ls=driver.findElements(By.xpath("//*[@id='innings_1']/div[1]/div/table/tbody/tr/td[3]"));
int sum=0;
for(int i=0;i<ls.size();i++)
int n=Integer.parseInt(ls.get(i).getText());




Replied on 22/08/2015

You are calculating sum here
We need to get the name of player with max runs

for that make a variable like

int maxScore;

This variable in loop should equate the highest score - You need to write logic for that Responsive image

Try Responsive image