instead of alert what can use to display message in javascript code example
Example: How do you handle js alerts?
If the alert on the browser comes from JavaScript, we use to
handle them Alert class.
Alert alert = driver.switchTo.alert();
alert.accept();
alert.dismiss();
alert.sendKeys();
alert.getText();