JavaScript alert handling issue

Hi Team,

In JavaScript alert handling, we have written a common function for capturing the alert message with accepting the alert.

While handling the alert, alert message has been retrieved but before accepting the alert, it is getting hide and error message is thrown.

Please find the attached video file for your reference. (2.0 MB)

Please find the script for handling JavaScript alert.

alertmessage= WebUI.getAlertText()

Kindly help me out to find a solution.

Is there any possible solution to accept the JavaScript alert.

1 Like


try to use Robot class
or native selenium

1 Like