# Can not Handle two consecutives alerts

**URL:** <https://forum.robotframework.org/t/can-not-handle-two-consecutives-alerts/3347>\
**Category:** Browser\
**Created:** [24 February 2022 18:18 UTC](https://forum.robotframework.org/t/can-not-handle-two-consecutives-alerts/3347 "2022-02-24T18:18:18Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![wojtekwp](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/wojtekwp/32/4058_2.png) [@wojtekwp](https://forum.robotframework.org/u/wojtekwp)\
**Post date:** [10 July 2024 10:21 UTC](https://forum.robotframework.org/t/can-not-handle-two-consecutives-alerts/3347/3 "2024-07-10T10:21:02Z")

</div>

Hello, I noticed same issue long time ago and I was willing that it will be resolved within next Browser releases but it still occurs.

ENV:

> Win 11 E  
> Python 3.11.9  
> NodeJS v20.15.1  
> Browser library 18.6.3  
> Robot Framework version: 7.0.1  
> Playwright 1.45.0

I’ve created simple html page with two alerts and simple RFB script where you can easily debug this issue. Manually alerts are visible and interactive. RFB scripts fails as its not able to handle multiple alerts. Please check below example manually vs via script.

**index.html**  
  
  
  
  
  
Multiple alerts issue - example  
  
  
Click to show alerts

```
    <script>
        function showAlerts() {
            confirm("First alert accepted?");
            alert("Second alert!");
        }
    </script>
</body>
</html>

```

**example.robot**  
\*\*\* Settings \*\*\*  
Library Browser

```
***Test Cases***
Alert-Debug
    Browser Setup
    #provide correct index.html path below
    Go To C:/alert_demo/index.html
    Click //button
    Validate Alert Response First alert accepted?
    Validate Alert Response Second alert!

***Keywords***
Browser Setup
    Set Browser Timeout 30
    New Browser browser=chromium headless=false args=["--start-maximized"]
    New Context viewport=${None}
    New Page url=about:blank

Validate Alert Response
    [Arguments] ${messageValue}
    ${message} = Wait For Alert action=accept text=${messageValue} timeout=5

```

Actual failure message:

> # TimeoutError: page.waitForEvent: Timeout 5000ms exceeded while waiting for event “dialog” =========================== logs =========================== waiting for event “dialog”
> 
> Tip: Use “Set Browser Timeout” for increasing the timeout.

---

_[View the full topic](https://forum.robotframework.org/t/can-not-handle-two-consecutives-alerts/3347)._
