Issues with Replay of Some Popup Alerts in BlazeMeter

book

Article ID: 210090

calendar_today

Updated On:

Products

BlazeMeter

Issue/Introduction

 

In a recorded scenario, a form is partially filled out, then an action is taken to navigate away from the form without saving the entered data.  This triggers a Popup Alert.  The Popup alert object is not properly captured by the Chrome Extension when the script is saved as a GUI Function scriptless test in BlazeMeter.   Efforts to use the AnswerDialog and AssertDialog Actions as recommended in the Taurus Actions for Scriptless Functional Testing article for handling popup alerts do not work.  When executing the script the error “unexpected alert open” is always generated when attempting to handle the popup window.

Error:

Popup:

Cause

These are special types of popups. They are not called directly like alerts or confirms.

A decision whether to show it or not is done by the browser, depending on what is returned from a beforeUnload event that the app can handle. Unfortunately, it's not possible to somehow "answer" them, but they can be suppressed.

Environment

Release : SAAS

Component : BLAZEMETER SCRIPTLESS

Resolution

This suppression might be a little bit dangerous, because it changes the handler for this event, removing any logic that was written there.  Nevertheless, if the decision is to suppress it, this can be done by putting a scriptEval action somewhere before the point when this dialog is shown and with the following script:

window.onbeforeunload = function(e) {
    delete e.returnValue;
}

This script makes "returnValue" of the event "undefined" and the browser will not show this dialog.

More details about "beforeUnload" event can be found here: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload

Attachments