• tahseenat

Handling Web Alerts


Introduction


Alert is a pop-up window that comes up on the screen. There are many user actions that can result in an alert on the screen. For e.g. user clicked on a button that displayed a message or maybe when you entered a form, the HTML page asked you for some extra information.

Alerts are different from regular windows. The main difference is that alerts are blocking in nature. They will not allow any action on the underlying webpage if they are present. So if an alert is present on the webpage and you try to access any of the elements in the underlying page you will get an exception.


Types of Alerts


There are basically three types of alert:

  1. Simple Alert

  2. Confirmation Alert

  3. Prompt Alert

Handling alerts using Selenium WebDriver


Selenium provides us with an interface called Alert. It is present in the org.openqa.selenium.Alert package. Alert interface gives us the following methods to deal with the alert:

  • accept() To accept the alert

  • dismiss() To dismiss the alert

  • getText() To get the text of the alert

  • sendKeys() To write some text to the alert


Examples


1.Simple Alert:


alert("This is a simple alert");


2.Confirmation Alert:


var popuResult = confirm("Confirm pop up with OK and Cancel button");


3.Prompt Alert:


var person = prompt("Do you like toolsqa?", "Yes/No");


Wizdom QA has created an end to end course curriculum for the SDET profile. Our students will receive in-depth knowledge of the latest QA tools, techniques and programming languages.

As a registered student, you will learn Selenium WebDriver, Appium for Mobile App automation, API automation, CI/CD integration and many more.

We have studied the market carefully and understood that there is a huge demand for good SDET profiles, however, finding the right candidate is quite hard because of the lack of right skills and experience among job seekers.

 

Therefore we are here with 11+ years of hands-on and training 800+ students to experience to create one-stop-shop course content for Software Development Engineering in Test (SDETs).

Address

Belgard Square West, Tallaght,

Dublin, Ireland

Phone & WhatsApp

+353 894740999

Email

info@wizdomqa.com

support@wizdomqa.com

Additional Links

Wizdom QA Trainings | All rights reserved | 2019-20 ©

  • Facebook Social Icon