New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Puppeteer click don't fail when actual element is overlapped #12221
Comments
This issue was not reproducible. Please check that your example runs locally and the following:
Once the above checks are satisfied, please edit your issue with the changes and we will |
Puppeteer has never implemented it so it is not a bug. It is possible to implement this client side by tracking what was actually clicked and it is a good idea to always do this to verify that the expectations of your actions are correct. We might want to include this into the locator API https://pptr.dev/guides/locators. |
Thanks for the response @OrKoN |
One way could be to await the click event to be actually emitted on the element you click:
There could be multiple reasons why it does not receive a click. Or you can use a modern API to check if element is covered before trying to click:
|
Thanks @OrKoN Let me this this out |
Minimal, reproducible example
Error string
no error
Bug behavior
Background
I'm trying to click an element on my page after performing some action.
Previous action renders a popup like element which covers the element. When I try to click the element before the overlapping popup closes, I expect puppeteer to fail. But, it don't throw any error.
I can add explicit timeout or wait for the overlapping element to be removed. But, why is puppeteer not throwing any error when element is not actually clicked?
I see puppeteer implementation of click is, just move the cursor to that x/y coordinate and do a mouse click. But, it's not actually validating it is clicking the element or some other element which is overlapping it.
WDIO has proper implementation of throwing an error for similar behaviour - https://webdriver.io/docs/api/element/click/
Expectation
I would expect page.click fails if element is overlapped by any other element.
Reality
Nothing happens. No error thrown by puppeteer.
Puppeteer configuration file (if used)
No response
Puppeteer version
22.6.2
Node version
20.11.1
Package manager
npm
Package manager version
10.2.4
Operating system
macOS
The text was updated successfully, but these errors were encountered: