Next, we will see how to create modal and non-modal alerts and also handle those through Selenium code. In modal alerts, we will see JavaScript alerts, and in non-modal alerts, we will see jQuery alerts. Let's first create some alerts.
Modal and non-modal alerts
Creating JavaScript and jQuery alerts
The following is the code to generate a simple modal alert in JavaScript. This alert in the code will appear on the main page and one cannot access the main page in the background until either the OK or Cancel button is clicked:
<html>
<head>
<script type="text/javascript">
function display_alerts(){
var text1;
if (confirm("Click")) {
text1 = "...