playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature]: Add `busy` option to `getByRole` method

Open markmur opened this issue 7 months ago • 0 comments

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

markmur avatar Jun 06 '25 15:06 markmur