[BUG] "Clicking the checkbox did not change its state" on rare occasions
See original GitHub issueContext:
- Playwright Version: @playwright/test 1.17.2
- Operating System: Linux
- Node.js version: 16.14
- Browser: Chrome Headless
- Extra: Run in Bitbucket Pipelines
Code Snippet
Trying to check a checkbox with following code:
await this.page!.check(`data-test-id=iAcceptUsageOfMyData`);
will result in about 1/20 of executions to this error:
Clicking the checkbox did not change its state
.
Describe the bug
The checkbox has no logic to be disabled or anything. Also, according to the Playwright trace it is perfectly visible (I would like to avoid the “force” flag if possible). Still, on about 1/10 or 1/20 executions, the test fails with the mentioned error.
The website has a sticky header at the top. Not sure if this might have any influence on the issue.
You can find a trace of a failed run here:
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Checkbox doesn't change its check-state when clicking on it
Given the problem its likely a CSS/Styling issue. I think some element is floating over the checkbox and preventing it from being clicked...
Read more >NVDA's handling of checkboxes especially in Google ...
Hello NVDA community! Why does NVDA not read some checkboxes in Google Chrome? NVDA reads a lot of them, but some sites have...
Read more >The most satisfying checkbox
The most satisfying checkbox for me has at most four frames of animation: checked, unchecked, clicked on and will toggle upon release, and...
Read more >411065 - Checkbox not changing when label is clicked
Hi, FWIW, this problem can be bypassed by using the CSS property -webkit-user-select:none, so it appears to be related to text selection.
Read more >Photos Can Help Diagnose Children's Eye Problems and ...
The red eye effect in photos, also known as the red reflex, can reveal surprising insights about children's eyes. The reflection of the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just saw that basically any input action (e.g. also
await page.click()
) can have the same problem. Do you have any generic advice how to solve the problem without using everywhere{force: true}
?You suggested to “wait until form stops changing”. How would you do this in a framework like vue.js or Angular?
Just had this issue in webkit tests with styled radio groups. Webkit trace for the radio check shows consistently off-target clicks. Our current workaround is having
await page.click("text=the text on it")
instead ofawait page.check("input[name=its name]", {force: true})
Firefox and Chrome tests were working usingpage.check
-method tho