We use cookies to ensure that we give you the best experience on our website. By continuing to browse or closing this banner, you acknowledge that you have read and agree to our Privacy Policy and Terms of Service.

Coding Jag - Get The Best News Around Test, DevOps & Automation To Your Inbox, Weekly!

Subscribe Now >
X

Javascript Alert Box Demo

This would be your first example to start with Selenium

JavaScript has three kind of popup boxes: Alert box, Confirm box, and Prompt box.

Let's try to see all the three examples below

Java Script Alert Box

When an alert box pops up, user have to click "OK" button to proceed.

Click the button to display an alert box:

Java Script Confirm Box

When a confirm box pops up, user can click "OK" or "Cancel" to proceed.

Box returns true, if the user clicks "OK" and box returns false if user clicks "Cancel"

Click the button to display an confirm box:

Java Script Alert Box

When a prompt box pops up, user can click "OK" or "Cancel" to proceed

If the user clicks "OK" after entering the input value, it will return value as Output. If the user clicks "Cancel" the box returns nothing.

Click below button for prompt box.