Is there a way I can simplify the code below?
public static void InputData(){
//Lastname
if (driver.findElements(By.id("last_name")).size() != 0) {
driver.findElement(By.id("last_name")).sendKeys("MARSUPIAL");
}
//Fistname
if (driver.findElements(By.id("first_name")).size() != 0) {
driver.findElement(By.id("first_name")).sendKeys("MARK");
}
}
I have 20 items with the same 'if' scenario
instead of doing "if object exist write 'x'" per text box is there a way to write it in a single if statement?
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire