# Check for a dialog box during process

**URL:** <https://discuss.elastic.co/t/check-for-a-dialog-box-during-process/295363>\
**Category:** Synthetics\
**Created:** [January 25, 2022, 3:09pm UTC](https://discuss.elastic.co/t/check-for-a-dialog-box-during-process/295363 "2022-01-25T15:09:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garry](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@Garry](https://discuss.elastic.co/u/Garry)\
**Post date:** [January 25, 2022, 3:09pm UTC](https://discuss.elastic.co/t/check-for-a-dialog-box-during-process/295363/1 "2022-01-25T15:09:09Z")

</div>

I have an application that, after login, may sometimes present a dialog box that you would click on an 'ok' button to remove.  
Other times the dialog box may not appear.  
Is their any method to check if the dialog box appears then act on it accordingly?

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [January 25, 2022, 4:00pm UTC](https://discuss.elastic.co/t/check-for-a-dialog-box-during-process/295363/2 "2022-01-25T16:00:09Z")

</div>

With synthetics you have the full power of JS/TS scripting, so you could definitely do this. [This section](https://playwright.dev/docs/selectors#selecting-elements-matching-one-of-the-conditions) in the Playwright guide should help you solve this problem.

---

<div class="post-metadata">

**Author:** ![Garry](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@Garry](https://discuss.elastic.co/u/Garry)\
**Post date:** [January 26, 2022, 2:24pm UTC](https://discuss.elastic.co/t/check-for-a-dialog-box-during-process/295363/3 "2022-01-26T14:24:47Z")

</div>

Thanks. Where would you suggest posting for Playwright code queries?

---

<div class="post-metadata">

**Author:** ![lucasfcosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lucasfcosta/32/97382_2.png) [@lucasfcosta](https://discuss.elastic.co/u/lucasfcosta)\
**Post date:** [January 27, 2022, 9:50am UTC](https://discuss.elastic.co/t/check-for-a-dialog-box-during-process/295363/4 "2022-01-27T09:50:19Z")

</div>

Hi Garry, when you ask about Playwright code queries do you mean where to post in order to obtain help related to using Playwright itself? Or do you mean selector queries to find elements?

If you're referring to the first, I'd probably recommend using the `playwright` tag on StackOverflow or [the GitHub repo for Playwright](https://github.com/microsoft/playwright).

If you referring to the second, I'd have a look at [this page](https://playwright.dev/docs/selectors).

---

<div class="post-metadata">

**Author:** ![Garry](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@Garry](https://discuss.elastic.co/u/Garry)\
**Post date:** [January 27, 2022, 4:41pm UTC](https://discuss.elastic.co/t/check-for-a-dialog-box-during-process/295363/5 "2022-01-27T16:41:53Z")

</div>

The issue I have is if I use the elastic recorder I get the following section auto generated...

await Promise.all([  
page.waitForNavigation(/_{ url: '[https://xxxxxxxxxxxxx](https://xxxxxxxxxxxxx)' }_/),  
page.frame({  
name: 'AxDojo\_Dialog\_frame\_1643298237258'  
}).click('text=OK')  
]);

'AxDojo\_Dialog\_frame\_1643298237258' changes however it always contains/starts with 'AxDojo\_Dialog\_frame'

I was thinking something along the lines of  
name: 'contains ('AxDojo\_Dialog\_frame')'

However i can't seem to get the syntax correct.  
Any ideas?

---

<div class="post-metadata">

**Author:** ![lucasfcosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lucasfcosta/32/97382_2.png) [@lucasfcosta](https://discuss.elastic.co/u/lucasfcosta)\
**Post date:** [January 28, 2022, 9:25am UTC](https://discuss.elastic.co/t/check-for-a-dialog-box-during-process/295363/6 "2022-01-28T09:25:21Z")

</div>

Hey Garry,

It seems like it's not possible to use a RegEx on the `page.frame` function itself, but it seems like it's possible to list frames with the `page.frames` API ([Page | Playwright](https://playwright.dev/docs/api/class-page#page-frames)). You could use that and then `.filter` using the desired regular expression or rule to choose the desired frame(s).

Overall, I'd really recommend Playwright's docs, they contain a great level of detail and quite a few useful examples.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 21, 2022, 9:25am UTC](https://discuss.elastic.co/t/check-for-a-dialog-box-during-process/295363/7 "2022-02-21T09:25:36Z")

</div>

This topic was automatically closed 24 days after the last reply. New replies are no longer allowed.
