Skip to content

[Feature]: Add busy option to getByRole method #36233

Closed as not planned
Closed as not planned

Description

@markmur

🚀 Feature Request

Hey folks 👋

Small request here - I'd love to contribute a busy option to the getByRole method to target elements with aria-busy.

Image

Example

Example JSX:

<div role="row">
  <div role="cell">Some text</div>
  <div role="cell" aria-busy={loading}>
    {loading ? <SkeletonText /> : <Text>Some text<Text>}
  </div>
<div>

Example usage in targeting the element:

this.page
  .getByRole('row')
  .getByRole('cell', {busy: false})

Motivation

We have several elements that render as skeleton blocks while loading and are then replaced with text on load finish. The goal here would be to use a locator to identify an element with a particular role but wait for aria-busy to be false.

Playwright already supports numerous aria properties here - such as expanded, pressed, selected etc. The inclusion of busy would be super helpful.

Alternatively if there's a better way to approach targeting these elements, I'm happy to hear your feedback.

Thanks ✌️

Activity

  1. tawago commented on Aug 8, 2025

    @tawago

    +1 for this!
    Targeting on a Skeleton loader element will be much easier with this.

  2. tawago commented on Aug 18, 2025

    @tawago

    Dmitry Gozman (@dgozman) just wondering, How many thumbs-up would be "popular" enough for the PR to be reopened?

  3. dosomder commented on Aug 20, 2025

    @dosomder

    Would be a really useful feature!

  4. zoehneto commented on Aug 20, 2025

    @zoehneto

    We would really appreciate this!

  5. dgozman commented on Aug 28, 2025

    @dgozman
    Collaborator

    As a workaround, try the following. Please let me know whether this helps.

    await page.getByRole('cell').locator(':scope[aria-busy=false]').click();
    
    // Alternatively, you can assert that it cell becomes non-busy at some point:
    await expect(page.getByRole('cell')).toHaveAttribute('aria-busy', 'false');
  6. dcrousso commented on Jun 15, 2026

    @dcrousso
    Contributor

    We have several elements that render as skeleton blocks while loading and are then replaced with text on load finish. The goal here would be to use a locator to identify an element with a particular role but wait for aria-busy to be false.

    rather than wait for aria-busy=false could you just wait for the final content to be present?

    more generally, can yall provide some specific usecases so we can better understand the problem trying to be solved?

  7. pavelfeldman commented on Oct 31, 2026

    @pavelfeldman
    Member

    We're closing all P3-collecting-feedback issues and retiring the label. #43813 explains why. This doesn't mean the request is wrong. If it still matters to you, please open a new issue against the latest Playwright version with your concrete use case and link back here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions