# Handling "Leave Site" prompt

**URL:** <https://forum.robotframework.org/t/handling-leave-site-prompt/7129>\
**Category:** Browser\
**Created:** [5 April 2024 15:07 UTC](https://forum.robotframework.org/t/handling-leave-site-prompt/7129 "2024-04-05T15:07:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ante](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@Ante](https://forum.robotframework.org/u/Ante)\
**Post date:** [5 April 2024 15:07 UTC](https://forum.robotframework.org/t/handling-leave-site-prompt/7129/1 "2024-04-05T15:07:49Z")

</div>

1. Write something in form on a site
2. Exit the site
3. Get dialog “Leave Site” saying “Changes you made may not be saved”.
4. It has two buttons - Leave and Cancel.

Have you encountered this in browser tests? Is there any way to access and operate these buttons?

---

<div class="post-metadata">

**Author:** ![CharlieScene](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/charliescene/32/3484_2.png) [@CharlieScene](https://forum.robotframework.org/u/CharlieScene)\
**Post date:** [5 April 2024 17:32 UTC](https://forum.robotframework.org/t/handling-leave-site-prompt/7129/2 "2024-04-05T17:32:36Z")

</div>

Hi,

Handling will be dependent of the way the message is designed in the application.  
If it’s a “homemade” prompt/alert, you may have to build keyword, wait and an click specific info available.

Other than that you could use this type of keyword :

```
Wait for alert

```

Or

```
Handle alert

```

That gives ability to choose accept or not, get the message or verify it usually.

Regards  
Charlie

---

<div class="post-metadata">

**Author:** ![Sriram](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@Sriram](https://forum.robotframework.org/u/Sriram)\
**Post date:** [8 April 2024 12:04 UTC](https://forum.robotframework.org/t/handling-leave-site-prompt/7129/3 "2024-04-08T12:04:34Z")

</div>

Handle alert action=ACCEPT

---

<div class="post-metadata">

**Author:** ![Ante](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@Ante](https://forum.robotframework.org/u/Ante)\
**Post date:** [9 April 2024 13:39 UTC](https://forum.robotframework.org/t/handling-leave-site-prompt/7129/4 "2024-04-09T13:39:46Z")

</div>

Thank you all.

```
Handle Future Dialogs action=accept

```

This did the trick.
