microsoft / microsoft/playwright

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

Open
#36,233 6 comments 22 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-role P3-collecting-feedback
Dominant language
TypeScript
Stars
96.4k
Forks
6.5k
Avg merge
1d 6h
Merged PRs (30d)
180

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the TypeScript getByRole implementation as the entry point, then trace how existing expanded, pressed, and selected options are handled. Add focused coverage for aria-busy true and false, and verify that the resulting locator behavior matches the requested examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.