Alerts are displayed, but disappear before I can accept it

Please let us know what you are using Katalon Studio for?

I’m testing the Clear Cache link on my page.
My automation is clicking the link and as a result of the click, an alert would normally appear and wait to be accepted.
I would accept the alert and continue on with the rest of the test.

However it seems to appear and disappear straight away, before I can accept it. This is causing the acceptAlert() to fail because the alert is no longer there to be accepted.

How would your work be affected if this issue has not been resolved?

Alerts on other pages are appearing and disappearing as well, before it can be accept it, which is causing my test to fail

Operating System

Windows 10

Katalon Studio Version

version 8.2.0 build 208

Katalon Studio logs

log.txt (205.7 KB)

Screenshots / Videos

2021-11-24_13h32_18.7z (2.6 MB)

In this video you can see something appear in the top left of the screen and then disappear.

Environment (for Web testing):

Microsoft Edge
Version 96.0.1054.29 (Official build) (64-bit)

Version 96.0.4664.45 (Official Build) (64-bit)

Steps to reproduce:

create a test case that ensures an alert will appear and acceptAlert


Expected Behavior:

I expect the WebUI.acceptAlert() to be able to accept the alert when it appears.

I run through the test manually and the alert appears and waits for me to accept it, this is working as expected.

Actual Behavior:

The alert appears and disappears before it can be accepted and causes my test to fail.


Hi Matthew, Well described, this is my problem too. Is it related to the new update 8.2. Before that, the problem didn’t exist.


I noticed the Webdrivers are not updating, I’m getting the following. It could be related

[ERROR] Driver for chrome not found (valid browsers chrome|firefox|opera|edge|phantomjs|iexplorer|selenium_server_standalone)

Warning: There are some errors during “Updating web driver…”. The results may not be as expected.

1 Like

Hi @Matthew_Loo,

Could you please provide us with more information about these items?

  • Your current WebDriver version
  • Execution log
  • Script sample to reproduce this issue

And have you faced this issue with the previous versions?

Nam Nguyen.

It goes so fast that there is indeed no possibility to click on it. This is a photo of a recording.


Maybe you can help me out here and give me instructions on how I can find the current WebDriver version.
at the moment I’m just trying to update to the latest drivers and I’m getting an error either it’s installed a bad driver, or I’m still running with an out of date driver. I wouldn’t know.

I’ve create alert.html to simulate the alert opening in the browser.

  • If you execute the file directly from the browser, you will see that the alert does not flash on and then off, it waits for input.

  • if you execute the test script, you will see it flash on and then off.

alert.html (245 Bytes)

The following test script will open the alert.html and display the alert, and attempt to accept it.
Of course you need to change the path to where ever you saved the alert.html

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.WebDriver as WebDriver
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import as Mobile
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import as Windows
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;



WebDriver wd =DriverFactory.getWebDriver();

WebElement elementOpen = wd.findElement(By.xpath(“/html/body/button”));;



This is the execution log I get when I run it
executionlog.txt (9.5 KB)

Thanks Heidi, for adding your supporting details


guys, this is major inconvenience ant it really upsets me that after almost every version update there are issues. this software is created and used for automation testing, yet it is apparent that your own regression testing process before the releases is flawed. This is the last chance you are getting from me, I have wasted two days trying to fix the issue, then realizing this must be your software’s issue, now a big chunk of my tests doesn’t work, which caused even more work for me as they have to be run manually. when is this going to be fixed?

Okay, since I didn’t get a reply from you, I decided to spend a little bit of time to find the drivers and I found this, it’s strange the folder for the Chrome driver is labeled with win32, not sure whether that’s significant or not, just thought I would mention it.

the chrome driver version is


Here’s a handy bit of information.

Terminate the running webdrivers before doing a webdriver update , this will mitigate any driver update issues. Not sure why Katalon doesn’t do it as part of it’s webDriver update process and It didn’t resolve the Alert issue. that’s still a problem


I could not see any Alert coming up in the video, so I’m confused.

here it is

and that’s the point. It flashes on and off, it doesn’t even have a chance to display text. It doesn’t stay on the screen. So it’s not visible and I can’t accept it, which causes my test to fail.

Watch the video again, even better pause the video and move the video to the same position in the image

I tried to reproduce your issue on my side usig the alert.html you shared. Yes, I could.

I executed thiis:

import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import com.kms.katalon.core.model.FailureHandling as FailureHandling

import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.navigateToUrl("http://localhost/alert.html") // I have a HTTP Server at http://localhost which makes the katalon project accessible as a web site. It does nothing special.
WebDriver wd = DriverFactory.getWebDriver();
WebElement elementOpen = wd.findElement(By.xpath("/html/body/button"));

boolean present1 = WebUI.verifyAlertPresent(5, FailureHandling.STOP_ON_FAILURE)
// this line passed; it meas an Aleart is there.
println("present1 :" + present1)


// we will check if the Aler is still there...
boolean present2 = WebUI.verifyAlertPresent(1, FailureHandling.CONTINUE_ON_FAILURE)   
// Chrome+FF+Edge; this line failed; it means no Alert is there.
// Safari; thiis line passed; it means an Alert is thre. Safari seems to be a bit loose.                                                  
println("present2? :" + present2)


on Chrome, Edge Chromium, FireFox, the 2nd WebUI.verifyAlertPresent() failed because the Alert has already disappeared automatically.

Interesting enough, on Safari, the 2nd WebUI.verifyAleartPresent() passed. I could see the Alert dialog stayed displayed on the screen.

So I guess that the newer version of security-conscious browsers (Chrome, Edge, FireFox) intentionally automatically closes Alert dialogs when a browser is controlled by software automation
like Selenium. I tried to search on Google for relevant articles on this issue, but I couldn’t find any.

I guess, Safari is outdated. Safari seems to be less security-conscious.

You may want to use Safari for this test. Safari seems to be your sole friend. :wink: But even Safari may change in future.

For your information, see this

To help protect your account, Google doesn’t let you sign in from some browsers. Google might stop sign-ins from browsers that:

Are being controlled through software automation rather than a human

This is a proof that Chrome behaves specially when it is controlled by selenium.

I guess browsers may do something special for Alert. Alert dialog could be risky because malicious software may use Alerts to invade your peaceful life.

Some people argue that we should not use JavaScript alert in productional web application. See, for example, this.

That’s not a very satisfactory answer, as you pointed out it’s only a matter of time before Safari starts acting the same way. The application I’m testing relays on alerts to confirm deletions, changes and saves. so you can imagine how redundant all my test cases and test suites have become. This must be happening to other tester out there, I’m surprised there isn’t a bigger commotion about this.

Also changing the way alerts are implemented , because my automation is broken would not fly with the development team. There’s time and cost to do this, especially when it works fine under normal conditions. There are much higher priorities, this would rank very lower or not at all.


You should try it.

If my guess — Chrome, Edge, FF does not allow automation software to test alerts, which would indicate the foreseeable direction of browser technology — is right, I think you should at least report to the development managers. You should tell them: “our application is not testable by Selenium at all due to javascript alert()!”

IMHO, they should not use JavaScript alert() for productional use cases.

There are alternatives how to implement alert dialog. For example,

JavaScript “alert()” is not the only way.

Dave-Evers, message helped me. Thanks Dave! Execute Javascript Alert Disappears