playwright: [BUG] Chromium: Cannot click, element intercepts pointer events
Context:
- Playwright Version: 1.20.0
- Operating System: Windows10
- Node.js version: LTS 16
- Browser: Chromium only
Describe the bug Trying to click on the ElementHandle, located by ElementHandle.waitForSelector() - fails in Chroimum with error
attempting click action
waiting for element to be visible, enabled and stable
element is visible, enabled and stable
scrolling into view if needed
done scrolling
performing click action
<span class="selection">…</span> intercepts pointer events
Works fine in Webkit and Firefox, was working fine in all browsers before 1.20.0 upgrade.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 17 (4 by maintainers)
Hi @dgozman
Here’s a repro for the chromium issue. Steps to reproduce:
http-serverNPM package)repro.zip
For those who read the thread till this point, as of
"@playwright/test": "^1.28.1", using the { force: true } option with the click method solves this issue:const nextButton = page.getByRole('button', { name: 'Suivant' }); await expect(nextButton).toBeEnabled(); await nextButton.click({ force: true});As others have already observed, invoking the
click()on the ancestor that listens to the mouse event seems to work around the issue.Instead of figuring out complicated selectors, you might as well select your favorite element in your preferred way and then use XPath get to the interactive ancestor:
await page.locator('.myclass').first().locator('xpath=../..').click();- in this example, I’m clicking the element two levels above the “myclass” elementDefinitely not a solution, but hopefully saves someone’s precious time.
Thanks for the investigation and the workaround @dgozman. It fills me with joy to have “Romimine”, which is the name we gave to the cat living in our garden, now part of the codebase of Playwright and used to fix an issue in chromium. 😂
I have the same problem. A test that passed with 1.19 now fails with 1.20. Here are some additional details:
I have a link looking like this:
Using
await page.click('text=Foo');fails on chromium, but passes on the other browsers.Changing it to
await page.click('text=Foo', { force: true });makes it pass on chromium, but then fails on webkit.Changing it to
await page.click('a:has-text("Foo")');makes it pass everywhere.To make things even more confusing, the failure on webkit happens on Github actions (Ubuntu VM), but doesn’t happen locally (macOS).