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)

Chrome
Version 96.0.4664.45 (Official Build) (64-bit)

Steps to reproduce:

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

WebUI.waitForAlert(5)
WebUI.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.

2 Likes

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.

1 Like

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.

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?

Regards,
Nam Nguyen.

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

image

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 com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords 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;

WebUI.openBrowser(’’)

WebUI.navigateToUrl(‘f:\Testing\alert.html’)

WebDriver wd =DriverFactory.getWebDriver();

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

elementOpen.click();

println(‘aaaaa’)
WebUI.verifyAlertPresent(5)

WebUI.acceptAlert()
println(‘bbbbbb’)
WebUI.delay(5)

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

Thanks Heidi, for adding your supporting details

Matt

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.
image

the chrome driver version is

image