# Check multiple selectors through page.locator call like puppeteer.locator.race

**URL:** <https://community.grafana.com/t/check-multiple-selectors-through-page-locator-call-like-puppeteer-locator-race/148741>\
**Category:** k6-browser\
**Created:** [April 23, 2025, 2:56am UTC](https://community.grafana.com/t/check-multiple-selectors-through-page-locator-call-like-puppeteer-locator-race/148741 "2025-04-23T02:56:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinodkr](https://avatars.discourse-cdn.com/v4/letter/v/a6a055/32.png) [@vinodkr](https://community.grafana.com/u/vinodkr)\
**Post date:** [April 23, 2025, 2:56am UTC](https://community.grafana.com/t/check-multiple-selectors-through-page-locator-call-like-puppeteer-locator-race/148741/1 "2025-04-23T02:56:46Z")

</div>

Is there way to look for multiple selectors at a time through page.locator ? case where page have result to display in table, or if no result to display, want to have page.locator to check either case.  
Just like what puppeteer provides, see below puppeteer sample.

```auto
 await puppeteer.Locator.race([
            targetPage.locator('#className'),
            targetPage.locator('::-p-xpath(//*[@id=\\"idValue\\"])')
        ])
            .setTimeout(timeout)
            .click();

```

---

<div class="post-metadata">

**Author:** ![joanlopez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/joanlopez/32/12328_2.png) [@joanlopez](https://community.grafana.com/u/joanlopez)\
**Post date:** [July 29, 2025, 5:08pm UTC](https://community.grafana.com/t/check-multiple-selectors-through-page-locator-call-like-puppeteer-locator-race/148741/3 "2025-07-29T17:08:43Z")

</div>

Hi @vinodkr,

First of all, apologies for the delayed answer. Somehow this got lost among my inbox.

As far as I know, [`Promise.race`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/race) is supported by k6.

So, I guess that you could build a similar construct with the Locator API from the k6 Browser module in combination with `Promise.race`.

Have you tried something like that? Did you encounter any issue with this approach?

I hope that helps! 🙇
