# Test Steps are all passed but Test case is failing with 'Alert Not Found'

**URL:** <https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [August 23, 2022, 12:34pm UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895 "2022-08-23T12:34:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![samuel.dasari](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@samuel.dasari](https://forum.katalon.com/u/samuel.dasari)\
**Post date:** [August 23, 2022, 12:34pm UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/1 "2022-08-23T12:34:11Z")

</div>

I have used keywords to verify the alert and its text, all those steps are being passed but test case is failing with No Alert Found error

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/f/5/f5ecbde2239d5231be8678908ba3d5221913a8d8.jpeg)

@katalon.team @Russ_Thomas @kazurayam

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 23, 2022, 12:56pm UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/2 "2022-08-23T12:56:33Z")

</div>

Recently a few people reported that Chrome browser closes the alert dialog quickly & intentionally. See

> [@Alerts are displayed, but disappear before I can accept it](http://forum.katalon.com/t/alerts-are-displayed-but-disappear-before-i-can-accept-it/60318/16):
>
> For your information, see this [https://support.google.com/accounts/answer/7675428?co=GENIE.Platform%3DAndroid&hl=en](https://support.google.com/accounts/answer/7675428?co=GENIE.Platform%3DAndroid&hl=en) 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 malic…

---

<div class="post-metadata">

**Author:** ![samuel.dasari](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@samuel.dasari](https://forum.katalon.com/u/samuel.dasari)\
**Post date:** [August 24, 2022, 8:59am UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/3 "2022-08-24T08:59:45Z")

</div>

I know we can handle this alert using different workarounds but still at the end Test case fails with the same error but step passes. I used the below code, let me know if I am doing this correctly?

Code:

```auto
public static boolean verifyAlertPresent(TestObject to) {
		WebUI.delay(3)
		KeywordUtil.logInfo("Inside While")
		while(!WebUI.verifyAlertPresent(3)) {
			KeywordUtil.logInfo("Alert Not Present")
			KeywordUtil.logInfo("Clicking Element")
			WebUI.enhancedClick(to)
			WebUI.delay(3)
		}

```

Even though my Test case fails…

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/6/f/6f6b3205b64f4052fdfe322c34669be9599b99ce.png)

@katalon.team @Russ_Thomas @nam.nguyen @duyluong

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 24, 2022, 9:32am UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/4 "2022-08-24T09:32:07Z")

</div>

> [@samuel.dasari](#):
>
> still at the end Test case fails with the same error but step passes.

I do not understand by this sentence what you don’t like.

> [@samuel.dasari](#):
>
> but step passes.

To me, apparently your test failed as it showed a ❌ mark in red color.

Do you want any more?

Which “step” do you want to fail with ❌?

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 24, 2022, 9:35am UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/5 "2022-08-24T09:35:50Z")

</div>

> [@samuel.dasari](#):
>
> I know we can handle this alert using different workarounds but still at the end

I am confused.  
The Stack Trace shows a message “No alert found”. This indicates to me that you could not handle the alert.  
So I do not see what you mean by saying “I know …”

---

<div class="post-metadata">

**Author:** ![samuel.dasari](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@samuel.dasari](https://forum.katalon.com/u/samuel.dasari)\
**Post date:** [August 24, 2022, 9:43am UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/6 "2022-08-24T09:43:53Z")

</div>

I am clicking the element and then asking to check for the alert after few seconds of delay using a while loop. I am clicking the element again if there is no alert until there is alert found.

I update my code as below but still my Test case fails please help me @kazurayam

```auto
public static verifyAlertPresent(TestObject to) {
		WebUI.delay(3)
		KeywordUtil.logInfo("Inside While")
		while(!WebUI.verifyAlertPresent(3,FailureHandling.OPTIONAL)) {
			KeywordUtil.logInfo("Alert Not Present")
			KeywordUtil.logInfo("Clicking Element")
			WebUI.enhancedClick(to)
			WebUI.delay(5)
		}
}

```

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 24, 2022, 9:48am UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/7 "2022-08-24T09:48:16Z")

</div>

Here I assume you are using Chrome browser.

Have you read this?

> **[Sign in with a supported browser - Android - Google Account Help](https://support.google.com/accounts/answer/7675428?co=GENIE.Platform%3DAndroid&hl=en)**
>
> To help protect your account, Google doesn’t let you sign in from some browsers. Google might stop sign-ins from browsers that: Don’t support JavaScript or have JavaScript turned off Have un

Chrome will intentionally closes Alert message when it is driven by Selenium and other test automation tools. Therefore, the your test script will ALWAYS find No Alert dialog.

I think you can not achieve what you want to do with Chrome.

---

<div class="post-metadata">

**Author:** ![samuel.dasari](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@samuel.dasari](https://forum.katalon.com/u/samuel.dasari)\
**Post date:** [August 24, 2022, 9:55am UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/8 "2022-08-24T09:55:46Z")

</div>

Ok is there any solution will using capabilities work?

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 24, 2022, 9:59am UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/9 "2022-08-24T09:59:59Z")

</div>

I don’t know.

But @Bailrod wrote something at

> [@Alerts are displayed, but disappear before I can accept it](http://forum.katalon.com/t/alerts-are-displayed-but-disappear-before-i-can-accept-it/60318/26):
>
> I though the point is resolved by adding Chrome capabilities UnexpectedAlertBehaviour=IGNORE no trouble since 2 days at last. Don’t know if it will work for you all folks. Cheers.

---

<div class="post-metadata">

**Author:** ![samuel.dasari](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@samuel.dasari](https://forum.katalon.com/u/samuel.dasari)\
**Post date:** [August 24, 2022, 10:10am UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/10 "2022-08-24T10:10:57Z")

</div>

I tried it but was not successful let me try it again carefully

Thank you @kazurayam

---

<div class="post-metadata">

**Author:** ![anon46315158](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@anon46315158](https://forum.katalon.com/u/anon46315158)\
**Post date:** [August 24, 2022, 6:02pm UTC](https://forum.katalon.com/t/test-steps-are-all-passed-but-test-case-is-failing-with-alert-not-found/68895/11 "2022-08-24T18:02:37Z")

</div>

if chrome stops supporting such automations, you guys should rethink your work.  
honestly, how relevant is an automated test which should crash the browser?  
such scenario should be tested manually, for the rest only sane possitive or negative tests should be automated.  
whatever depends on the under the hood OS and is browser specific makes no sense to be automated since such can change overnight.  
simply does not justify the effort to catch all cases
