# How to Handle Browser alerts

**URL:** <https://forum.katalon.com/t/how-to-handle-browser-alerts/29780>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [July 17, 2019, 11:43am UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780 "2019-07-17T11:43:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sreeravella](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@sreeravella](https://forum.katalon.com/u/sreeravella)\
**Post date:** [July 17, 2019, 11:43am UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/1 "2019-07-17T11:43:57Z")

</div>

Hi,

Any one can help me, how to handle browser alerts.

I have used, ‘WebUI.acceptAlert()’ and  
driver.switchTo().alert().accept().

But it is not working. Please check the attached screenshot for alert reference.

Thankyou,  
Sree.

 ![Screenshot%20from%202019-07-16%2018-48-24](https://europe1.discourse-cdn.com/katalon/original/2X/c/c7234572e63b4eea38e815198a1bd9d16193aceb.png)

---

<div class="post-metadata">

**Author:** ![Nilau](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@Nilau](https://forum.katalon.com/u/Nilau)\
**Post date:** [July 17, 2019, 3:47pm UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/2 "2019-07-17T15:47:12Z")

</div>

Have you tried this :

> **[How to Handle Alerts](https://docs.katalon.com/katalon-studio/docs/handle_alerts.html#what-is-an-alert)**
>
> The alerts that are used to notify users on a Web page can be handled using Katalon Studio. This tutorial shows how to do so with HTML examples.

---

<div class="post-metadata">

**Author:** ![sreeravella](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@sreeravella](https://forum.katalon.com/u/sreeravella)\
**Post date:** [July 18, 2019, 5:31am UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/3 "2019-07-18T05:31:57Z")

</div>

```auto
WebUI.openBrowser('C:\\\\Users\\\\User\\\\Desktop\\\\How to Handle Alerts.html')
 
'Maximize the window of the browser'
 
WebUI.maximizeWindow()
 
'Clicking on button'
 
WebUI.click(findTestObject('Alerts/button_ClickHere'))
 
'Accepting the Alert'
 
WebUI.acceptAlert()

```

1.) I have not understood this, here in open browser which path I should need to give.

2.) ‘Clicking on button’

WebUI.click(findTestObject(‘Alerts/button\_ClickHere’))

How should I give the xpath for clicking on object, since I don’t have any xpath for alert.

---

<div class="post-metadata">

**Author:** ![rizky.aninidita](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@rizky.aninidita](https://forum.katalon.com/u/rizky.aninidita)\
**Post date:** [February 4, 2020, 9:07am UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/4 "2020-02-04T09:07:01Z")

</div>

i have same stuck in this alert 🤧

---

<div class="post-metadata">

**Author:** ![gauthamkarthik534](https://avatars.discourse-cdn.com/v4/letter/g/a587f6/32.png) [@gauthamkarthik534](https://forum.katalon.com/u/gauthamkarthik534)\
**Post date:** [April 28, 2020, 12:56pm UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/5 "2020-04-28T12:56:24Z")

</div>

Complete demo on alerts explained below

---

<div class="post-metadata">

**Author:** ![hendrixora](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hendrixora/32/23869_2.png) [@hendrixora](https://forum.katalon.com/u/hendrixora)\
**Post date:** [September 29, 2023, 7:26am UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/6 "2023-09-29T07:26:49Z")

</div>

Do you already solve this? I have the same issue

---

<div class="post-metadata">

**Author:** ![atul.rai](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/atul.rai/32/22830_2.png) [@atul.rai](https://forum.katalon.com/u/atul.rai)\
**Post date:** [September 29, 2023, 12:42pm UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/7 "2023-09-29T12:42:30Z")

</div>

Use below and replacing correct object repository in to repository .  
WebUI.waitForElementVisible(findTestObject(‘Object Repository/’), 5, FailureHandling.OPTIONAL)  
WebUI.click(findTestObject(‘Object Repository/’), FailureHandling.OPTIONAL)

---

<div class="post-metadata">

**Author:** ![hendrixora](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hendrixora/32/23869_2.png) [@hendrixora](https://forum.katalon.com/u/hendrixora)\
**Post date:** [September 29, 2023, 11:08pm UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/8 "2023-09-29T23:08:33Z")

</div>

How can you target the alert via object repository? I cannot capture it via web spy or recording. Alert is the main concern here.

---

<div class="post-metadata">

**Author:** ![atul.rai](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/atul.rai/32/22830_2.png) [@atul.rai](https://forum.katalon.com/u/atul.rai)\
**Post date:** [September 30, 2023, 4:25am UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/9 "2023-09-30T04:25:44Z")

</div>

Okay Let us see.

---

<div class="post-metadata">

**Author:** ![bharathi.a](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/bharathi.a/32/24695_2.png) [@bharathi.a](https://forum.katalon.com/u/bharathi.a)\
**Post date:** [September 30, 2023, 5:28am UTC](https://forum.katalon.com/t/how-to-handle-browser-alerts/29780/10 "2023-09-30T05:28:49Z")

</div>

This is not an alert from your application. this is a Permission request from the Chrome Browser.

you have to use Chrome options to handle this one  
i hope the following topics help you

1. [python - How to allow permissions to content in Chrome - Stack Overflow](https://stackoverflow.com/questions/47835771/how-to-allow-permissions-to-content-in-chrome)
2. [python 2.7 - Accept permission request in chrome using selenium - Stack Overflow](https://stackoverflow.com/questions/21628904/accept-permission-request-in-chrome-using-selenium)
3. [How do I choose to "always allow" in the popup notification in Google Chrome with Selenium/java? - Stack Overflow](https://stackoverflow.com/questions/69368492/how-do-i-choose-to-always-allow-in-the-popup-notification-in-google-chrome-wit)  
4.[Handling Permission Popups with Selenium WebDriver](https://testingbot.com/support/selenium/permission-popups)
