You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
start src/index.html with live server or such tools and visit http://127.0.0.1:5500/src/index.html (port may depend on your environment
run npm run test
you will see such result below
Running 1 test using 1 worker
[chromium] › repro.spec.ts:3:5 › click two textboxes
textbox1 1
textbox2 0
1) [chromium] › repro.spec.ts:3:5 › click two textboxes ────────────────────────────────────────────────────
Test timeout of 30000ms exceeded.
Error: locator.click: Test timeout of 30000ms exceeded.
Call log:
- waiting for getByRole('textbox', { name: 'TestField2' })
9 | const textbox2 = page.getByRole("textbox", { name: "TestField2" });
10 | console.log("textbox2", await textbox2.count());
> 11 | await textbox2.click();
| ^
12 | });
13 |
at /Users/y_oyama/Desktop/playwright-getByRole-repro/tests/repro.spec.ts:11:17
Slow test file: [chromium] › repro.spec.ts (30.0s)
Consider splitting slow test files to speed up parallel execution
1 failed
[chromium] › repro.spec.ts:3:5 › click two textboxes ─────────────────────────────────────────────────────
Expected behavior
We want to see such result below and want test to pass (number represents the count of found elements).
textbox1 1
textbox2 1
Actual behavior
textbox2 is not found by getByRole and test is fail.
Additional context
In Chrome browser, when we check the input element of TextField2 with devtools, we can see such a11y information.
This shows this input element has accessible name 'TestField2' from wrapped label and invalid aria-labelledby is disabled, so we want to get this element with getByRole('textbox', { name: 'TestField2' }. But playwright can't find this element with such query probably because getByRole doesn't find it by proper way.
Thank you for checking my issue.
The text was updated successfully, but these errors were encountered:
mehm8128
changed the title
[Bug]: getByRole can't find element from label when aria-labelledby is not valid
[Bug]: getByRole can't find element from label element when aria-labelledby is not valid
Nov 17, 2024
mehm8128
changed the title
[Bug]: getByRole can't find element from label element when aria-labelledby is not valid
[Bug]: getByRole can't find element with the accessible name from label element when aria-labelledby is not valid
Nov 17, 2024
Version
1.48.2
Steps to reproduce
npm i
src/index.html
with live server or such tools and visithttp://127.0.0.1:5500/src/index.html
(port may depend on your environmentnpm run test
Expected behavior
We want to see such result below and want test to pass (number represents the count of found elements).
Actual behavior
textbox2
is not found bygetByRole
and test is fail.Additional context
In Chrome browser, when we check the input element of
TextField2
with devtools, we can see such a11y information.This shows this input element has accessible name 'TestField2' from wrapped label and invalid
aria-labelledby
is disabled, so we want to get this element withgetByRole('textbox', { name: 'TestField2' }
. But playwright can't find this element with such query probably becausegetByRole
doesn't find it by proper way.Thank you for checking my issue.
Environment
The text was updated successfully, but these errors were encountered: