playwright: [Bug]: button click timeout (headless WebKit on Ubuntu 24.04.1 LTS)

Version

1.48.0

Steps to reproduce

  1. Launch a fresh instance of Ubuntu 24.04.1 LTS (see Additional context for details)
  2. Run bug-playwright-button-click/init.sh (uses nodesource instructions for Node.js 20 installation)

Expected behavior

All tests should pass.

Actual behavior

Some tests fail:

/usr/bin/npm run e2e

> bug-playwright-button-click@1.0.0 e2e
> playwright test


Running 9 tests using 4 workers
  1) [webkit] › button-user-interactions.spec.ts:12:7 › Button user interactions › Click ───────────

    Test timeout of 5000ms exceeded.

    Error: locator.click: Test timeout of 5000ms exceeded.
    Call log:
      - waiting for getByLabel(/light mode/i)
      -   locator resolved to <button disabled type="button" aria-live="polite" class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" title="Switch between dark and light mode (currently dark mode)" aria-label="Switch between dark and light mode (currently dark mode)">…</button>
      - attempting click action
      -   waiting for element to be visible, enabled and stable


      11 |
      12 |   test("Click", async ({ page }) => {
    > 13 |     await button.click();
         |                  ^
      14 |   });
      15 |
      16 |   test("Press enter", async ({ page }) => {

        at ~/bug-playwright-button-click/tests/button-user-interactions.spec.ts:13:18

  2) [webkit] › button-user-interactions.spec.ts:20:7 › Button user interactions › Tap ─────────────

    Test timeout of 5000ms exceeded.

    Error: locator.tap: Test timeout of 5000ms exceeded.
    Call log:
      - waiting for getByLabel(/light mode/i)
      -   locator resolved to <button disabled type="button" aria-live="polite" class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" title="Switch between dark and light mode (currently dark mode)" aria-label="Switch between dark and light mode (currently dark mode)">…</button>
      - attempting tap action
      -   waiting for element to be visible, enabled and stable


      19 |
      20 |   test("Tap", async ({ page }) => {
    > 21 |     await button.tap();
         |                  ^
      22 |   });
      23 | });
      24 |

        at ~/bug-playwright-button-click/tests/button-user-interactions.spec.ts:21:18

  2 failed
    [webkit] › button-user-interactions.spec.ts:12:7 › Button user interactions › Click ────────────
    [webkit] › button-user-interactions.spec.ts:20:7 › Button user interactions › Tap ──────────────
  7 passed (9.9s)

  Serving HTML report at http://localhost:9323. Press Ctrl+C to quit.


Additional context

The tests only fail in specific conditions: only WebKit in --headless or --ui mode in Ubuntu 24.04.1 LTS (on my current machine and also on a fresh install).

I tried various combinations:

  • Tests pass on Ubuntu 22 LTS but fail on Ubuntu 24 LTS.
  • CI tests pass with GitHub Actions (ubuntu-latest still uses Ubuntu 22 LTS).
  • Tests always pass when run in --headed mode regardless of Ubuntu version.
  • Tests pass when running on WSL and multipass with Ubuntu 24.04.1 LTS (maybe because of the lack of a desktop environment or differences in the installed packages).

A simple workaround is to use button.press("Enter") instead of button.click() and button.tap().

Environment

System: OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat) CPU: (8) x64 Intel® Core™ i3-10100 CPU @ 3.60GHz Memory: 10.36 GB / 15.24 GB Container: Yes Binaries: Node: 20.18.0 - /usr/bin/node npm: 10.9.0 - /usr/bin/npm pnpm: 9.12.1 - /usr/bin/pnpm Languages: Bash: 5.2.21 - /usr/bin/bash npmPackages: @playwright/test: ^1.48.0 => 1.48.0

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 15
  • Comments: 22 (7 by maintainers)

Commits related to this issue

Most upvoted comments

We get the same issue on Ubuntu 24.04.1 with Python 3.12.3 and Playwright 1.49.1.

The same test runs without issues on Ubuntu 22.04.5 LTS with Python 3.10.12 and Playwright 1.47.0. The issue can be resolved by using the force argument in page.locator(".some_class").click(force=True), but I would rather avoid enforcing it.

I am also noticing this issue using Pop!_OS 22.04 LTS Node: v22.12.0