I just have a simple enough question on an issue im having, im trying to set a string value to "0" if a webelement isnt present else the string is the the webelement value (using getText) however i can seem to use these values ouside of the if and else statement, how do i do this? Here is my code
String players_in_game = null;
public void join_game_user_increases_register() throws Exception {
WebDriverWait wait = new WebDriverWait(Drivers.getDriver(), 10);
wait.until(ExpectedConditions.visibilityOf(countdownLabel));
if(!num_of_players_in_game.isDisplayed()){
String players_in_game = "0";
} else {String players_in_game = num_of_players_in_game.getText();}
System.out.println(players_in_game);
int first_num = Integer.parseInt(players_in_game);
Aucun commentaire:
Enregistrer un commentaire