Skip to content
Discussion options

You must be logged in to vote

Recorded as bug in #2715, fixed by #2716

ComboBox now uses labelText as the fallback for aria-label when it is not explicitly provided. When labelText="Contact" is set, the accessible name matches the label, so Playwright's getByLabel works.

$: ariaLabel = $$props["aria-label"] ?? (labelText || "Choose an item");

Playwright usage (ComboBox)

Option 1: getByLabel with labelText

test("ComboBox by label", async ({ page }) => {
  await page.goto("/your-combobox-page");
  const combobox = page.getByLabel("Contact").locator("input");
  await combobox.click();
  await combobox.fill("Email");
  await expect(combobox).toHaveValue("Email");
});

Option 2: data-testid

For more reliable and stable sel…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by metonym
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants