Loading...

How to Handle Alerts

What is an alert?

An alert is a JavaScript function which is used to notify users on a Web page. It displays a dialog with a specified message and OK/Cancel buttons.

The alert is a modal dialog that takes the focus away from the current window and forces the user to take action before performing other actions. It also prevents the user from accessing other parts of the page until the user performs the action presented in the dialog. For example, when the user clicks on the "Delete" button, an alert would be triggered asking user 'Are you sure, you want to delete?' The user has to take action on this dialog.

Such an alert can be handled using akaAT Studio built-in keywords. This tutorial shows how to do so with HTML examples.

You can get the HTML by clicking here.

Handle Alerts using akaAT Studio

1. Handle Accept Alert

This alert method is used to confirm an action performed by the user. You can handle this method either in the manual modes.

Manual Mode

  • Step 1: Launching the browser navigating to Alert present page by Open Browser method
  • Step 2: Switching to action frame with available ID
  • Step 3: Clicking on button “Try it” with Xpath below:
  • Step 4: Calling the Accept alert method

2. Handle Dismiss Alert

This alert method is used to ask the user to cancel something.

Manual Mode

  • Step 1: Launching the browser navigating to Alert present page by Open Browser method
  • Step 2: Switching to action frame
  • Step 3: Clicking on button “Try it”
  • Step 4: Calling the Dismiss alert method

3. Send data to an alert dialog

We can pass text to an Alert text message by using the  Set Alert Text method.

Manual Mode

  • Step 1: Launching the browser navigating to Alert present page by Open Browser method
  • Step 2: Switching to action frame
  • Step 3: Clicking on button “Try it”
  • Step 4: Calling method Set Alert Text

4. Capture the alert message

We can capture the message on Alert by using the Get Alert Text method.

Manual Mode

  • Step 1: Launching the browser navigating to Alert present page by Open Browser method
  • Step 2: Switching to action frame
  • Step 3: Clicking on button “Try it”
  • Step 4: Getting the text from the alert and storing it in Variable
  • Step 5: Verifying the Actual and Expected text from Alert

Blog Posts

Image

Getting Started

Go to akaAT Download page to get the latest version of akaAT Studio. A suitable version for your system will be automatically detected and recommended for download...

Continue Reading...

Image

Define Test and Variables

In this chapter, we’ll first define the steps of the data-driven test. Then, we’ll define the required variables for this scenario. You’ll also find out how to manage variables in akaAT Studio...

Continue Reading...

Image

Multi-touch Actions in Mobile App

Multi-touch action often appears in gaming applications. This tutorial shows you how to perform a multi-touch action...

Continue Reading...

Image

Web Handling

What are Locators?
Locators are basically the HTML attributes of a web element. They help identify unique web elements on a page and command testing frameworks...

Continue Reading...

Image

Pop-up Handling

When performing automation testing, you may sometimes deal with pop-up dialog issue that needs to be handled differently from normal test objects. This tutorial shows you how to deal with pop-up controls....

Continue Reading...

Image

Alert Handling

What is an alert?
An alert is a JavaScript function which is used to notify users on a Web page. It displays a dialog with a specified message and OK/Cancel buttons...

Continue Reading...

Image

Textbox Handling

This tutorial illustrates how to handle Textbox, Checkbox, Radio buttons using akaAT Studio. The reference source code is provided at the end of the tutorial...

Continue Reading...

Image

iFrame Issue Handling

A very common type of control used in website is the HTML iframe. And this control needs to be handled in a specific manner when testing. This article shows you how to handle iframes...

Continue Reading...

Image

Dropdown Handling

A drop-down list (abbreviated drop-down; also known as a drop-down menu) is a graphical control element, similar to a list box, that allows the user to choose one value from a list...

Continue Reading...

Image

Static and Dynamic Test Objects Handling.

Test Objects are one of the most crucial parts of building a successful automation project. Some of them are static (do not change at all) and some of them are dynamic (they are dependent on some dynamically changing parameters)...

Continue Reading...