This a login test scenario. There are two user. They are valid and invalid users. Pop-up OK click is working in testing.
<---- PROBLEM ----->
If ----> (if not an element exists) ---- print("successfuly login"),
else ----> (if an element exists) ----- pop-up ok click. Login with other users.
I can't do this no such element case.
ERROR
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"html/body/div/div/div[3]/button[1]"}
(Session info: chrome=79.0.3945.88)
CODE
WebElement temp444 = driver.findElement(By.xpath("html/body/div/div/div[3]/button[1]"));
System.out.println(temp444.getSize());
if(temp.getSize()!=null){
temp.click(); // ----> It's working!
}
else {
System.out.println("good working"); // ----> It isn't working.
}
Aucun commentaire:
Enregistrer un commentaire