I used below selenium codes to click "OK" alert box, But It is not identifying, I dont knw wht's the reason, Can anyone help to solve this Issue ?
Element image:
Code trials:
Alert click_on_update_button_Htwelveyes = driver.switchTo().alert();
click_on_update_button_Htwelveyes.accept();
}
Console Output:
org.openqa.selenium.NoAlertPresentException: no such alert
(Session info: chrome=103.0.5060.134)
CodePudding user response:
Alert
An alert box is used if the user wants to make sure information comes through to the user. The user will have to click on OK to agree or Cancel to deny the information.
This usecase
The following element doesn't seems to be an alert but a Modal Dialog Box :
In such cases you need to locate the element with the Modal Dialog Box to locate the element with text as Yes or No and invoke click() on the respective element of youe choice.