Introducing package: import org.openqa.selenium.Alert;
The alert box shells js
Alert alert = driver.switchTo () alert ();. // get the object and create alert
alert.getText (); // get the text pop-up box
alert.accept (); // Click the OK button in the pop-up box above
========================================================================
js confirm the elastic block
Alert alert = driver.switchTo () alert ();. // get the object and create alert
alert.getText (); // get the text pop-up box
alert.accept (); // Click the OK button in the pop-up box above
alert.dismiss (); // Click the pop-up box above the Cancel button
========================================================================
js the prompt box shells
Alert alert = driver.switchTo () alert ();. // get the object and create alert
alert.getText (); // get the text pop-up box
alert.sendKeys ( "............"); // typing
alert.accept (); // Click the OK button in the pop-up box above
alert.dismiss (); // Click the pop-up box above the Cancel button