Skip to content

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

Open
@markmur

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 ✌️

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions