1// Alert used to display a message to the user.
2alert("Hello, World!"); // Displays Hello, World! to the user.
3// You can also use:
4window.alert("Hello, World!"); // Also displays Hello, World! to the user.
1If the alert on the browser comes from JavaScript, we use to
2handle them Alert class.
3Alert alert = driver.switchTo.alert();
4alert.accept();
5alert.dismiss();
6alert.sendKeys();
7alert.getText();