selenium click alert

 

 

OK, Show you the code:

1 driver.findElement(By.id("updateButton")).click();
2 //pop up with id "updateButton" opens
3 Alert alert = driver.switchTo().alert();
4 //update is executed
5 alert.accept();

If it is click cancel, then:

alert.dismiss();

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326377752&siteId=291194637