playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug]: Click times out despite actually performing the click

Open hnhaefliger opened this issue 6 months ago • 3 comments

Version

1.52.0

Steps to reproduce

  1. Checkout my repo: https://github.com/hnhaefliger/playwright-repro.
  2. Run npm run click-times-out (this may take a couple of runs or tinkering with the click timeout in tests/click-times-out.spec.ts to repro as the issue is not 100% deterministic).
  3. Inspect the trace.
  4. See that the click action has failed due to timeout, but the click actually did occur.

Alternatively, once you've checked out the repo, run npx playwright show-trace test-results/click-times-out-Click-times-out-despite-performing-click-webkit/trace.zip to view the trace that I added.

Image

Expected behavior

I would expect the test to either: a. time out, but not perform the click b. perform the click, but not time out

Actual behavior

The click happened, but the action timed out.

Additional context

This is a bit of a contrived example - the timeout is ridiculously low in the interest of finding a minimal repro - but we're observing this on production sites with a 5000ms timeout.

Environment

System:
    OS: macOS 15.5
    CPU: (14) arm64 Apple M3 Max
    Memory: 1.11 GB / 36.00 GB
  Binaries:
    Node: 22.13.1 - ~/Library/pnpm/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.9.0/bin/yarn
    npm: 10.9.2 - ~/Library/pnpm/npm
    pnpm: 8.10.2 - ~/Library/pnpm/pnpm
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.52.0 => 1.52.0 
    playwright: ^1.52.0 => 1.52.0

hnhaefliger avatar Jun 03 '25 17:06 hnhaefliger

I would also be satisfied with knowing if the presence of the "performing click action" log guarantees that the click occurred, that way I can detect that and ignore those errors.

hnhaefliger avatar Jun 03 '25 17:06 hnhaefliger

Thank you for the repro. I can reproduce. Most likely this is caused by the epilogue present in all pointer events: https://github.com/microsoft/playwright/blob/70d64a2978ec482aa56434922519a4ea3cdc7ff2/packages/playwright-core/src/server/frames.ts#L170-L176

These can be cancelled by the timeout, at which point we mark the call as failed.

It is non-obvious how this should be properly handled. We will have to think about it.

agg23 avatar Jun 04 '25 13:06 agg23

Thanks! I think if there was just a way to determine whether the click happened or not that would be good enough for my use case - like if there was an additional log immediately after the action function call.

hnhaefliger avatar Jun 05 '25 20:06 hnhaefliger

@hnhaefliger I don't think there is anything to change in Playwright here. The click has happened, but timeout has been reached. That's unfortunate, but there seems to be no good mitigation.

Take a look at noWaitAfter option, it might help in this case. Closing as there is no action item. Thank you for filing!

dgozman avatar Jul 01 '25 14:07 dgozman