]I am automating baseball sports activities reporter software. My software is a desktop software. I am utilizing winium device with java language. In my software desk comprise participant names in alphabetical order. I wish to choose 8 gamers from the checklist in identical order as you possibly can see above order. And in addition I wish to choose the matching positions.
These are the gamers that i want to pick out::
#gamers names :: positions
Happ = CF
Bryant = 3B
Rizzo = 1B
Contreras = C
Schwarber = LF
Russell = SS
Heyward = RF
Baez = 2B
now i want to pick out the actual gamers that I discussed above checklist order.
My software handbook working course of is first double click on a participant and imply time a window got here to pick out the place by single click on. instance firstly , I want to pick out the participant Happ and his place CF(heart subject) then choose the participant Bryant and his place 3B(third base) and many others…
public void awayTeamHitters() {
attempt
{
String[] gamers = new String[]
{
"Happ, Ian#",
"Bryant, Kris",
"Rizzo, Anthony*",
"Contreras, Willson",
"Schwarber, Kyle*",
"Russell, Addison",
"Heyward, Jason*",
"Baez, Javier"
};
String[] positions=new String[]
{
"CF",
"3B",
"1B",
"C",
"LF",
"SS",
"RF",
"2B"
};
Record playersInList = Arrays.asList(gamers);
Record positionsInlist=Arrays.asList(positions);
//choosing gamers of two desk
driver.findElement(By.id("lblAwayTeamHittersAll")).click on(); // click on on 2 tables all gamers
WebElement table1 = driver.findElement(By.id("lsvAwayTeamHitters1"));
WebElement table2 = driver.findElement(By.id("lsvAwayTeamHitters2"));
//taking row dimension
Record rows1 = table1.findElements(By.xpath("./*[contains(@LocalizedControlType, 'item')]"));
Record rows2 = table2.findElements(By.xpath("./*[contains(@LocalizedControlType, 'item')]"));
//create string array add gamers to player_table1
Record player_table1=new ArrayList();
for(int i=0;i cols1 = rows1.get(i).findElements(By.xpath("./*[contains(@LocalizedControlType, 'text')]"));
for(int j=3;j player_table2=new ArrayList();
for(int i=0;i cols2 = rows2.get(i).findElements(By.xpath("./*[contains(@LocalizedControlType, 'text')]"));
for(int j=3;j player_table3=new ArrayList();
player_table3.addAll(player_table2);
System.out.println(player_table3); //it should print the 25 participant names
int p=player_table3.dimension();
System.out.println(p); //it should print the scale 25
for(int i=0;i col=pos.findElements(By.xpath("./*[contains(@LocalizedControlType, 'button')]"));
if(positionsInlist.incorporates(col)) {
pos.click on();
}
}
}
catch (Exception e) {
System.out.println(e);
}
}
}
I’ve 2 tables in my software and I add it into one checklist..
Right here double click on motion isn’t performing and after printing 25 participant names and dimension .it should received cease.