im trying to compare the pick status of each previous row to ensure the pick status is higher than the previous. The user makes 4 picks and if the pick status is 1 or 2 its added to the pick status total. The user with the highest total of "won_and_looking_good" tops the table, but if the user has the same total then their points_player is taken into consideration. Im basically trying to compare the total_of_won_and_looking_good with the total_of_won_and_looking_good from the previous row, i can seem to figure out how to to do this. This is my code.
public void test_player_leaderboard_entry() {
int size = playerRows.size();
for (int i = 0; i < size; i++) {
//POSITION
String position_first_player = Drivers.getDriver().findElement(By.cssSelector("[data-qa-position-value='" + i + "']")).getText();
//POINTS
String points_player = Drivers.getDriver().findElement(By.cssSelector("[data-qa-points-value='" + i + "']")).getText();
//USERNAME
String username_player = Drivers.getDriver().findElement(By.cssSelector("[data-qa-player-value='" + i + "']")).getText();
//ROW NUMBER
Integer row = i + 1;
Integer total_of_won_and_looking_good = 0;
//PICKS
for (int pick_number = 1; pick_number < 5; pick_number++) {
String pick_status = Drivers.getDriver().findElement(By.xpath("//*[@id='root']/div/main/section[2]/section/div/ol/a[" + row + "]/li/div[3]/div[" + pick_number + "]/div")).getAttribute("data-qa-pick-state");
//System.out.println(pick_status);
if (Integer.parseInt(pick_status) == 2 || Integer.parseInt(pick_status) == 1) {
total_of_won_and_looking_good = total_of_won_and_looking_good + 1;
}
//System.out.println(total_of_won_and_looking_good);
}
System.out.println("On row number " + row + " we find " + username_player + " in position " + position_first_player + " with " + total_of_won_and_looking_good + " correct picks and " + points_player + " points!");
}
}
Aucun commentaire:
Enregistrer un commentaire