playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug]: Screenshots timing out when using chrome extension in new headless mode

Open jeff-an opened this issue 1 year ago • 1 comments

Version

1.44.1, 1.48.2

Steps to reproduce

Minimal reproduction is available in this pull request in my public demo repository: https://github.com/jeff-an/playwright-shadow-dom-repro/pull/1. The main Playwright script is here while the github action workflow is defined here.

The failure can be seen in the Github actions failure, which only attempts to take a screenshot of Google.com but fails.

The Chrome extension being used is the popular https://darkreader.org/. It works totally fine on my official Chrome build and on Chromium when ran on my Mac OS laptop. However, it does not work when running on Linux.

Interestingly this flow used to work last week and I don't think I changed the Playwright version used or any dependencies. Maybe something on the default Github Actions runners changed? DEBUG=pw:api just says screenshot started and then screenshot failed with nothing useful in between.

Expected behavior

Screenshot should succeed within a reasonable time.

Actual behavior

Screenshot fails after 3 seconds. Tried the following:

  • increasing timeout
  • PW_TEST_SCREENSHOT_NO_FONTS_READY = 1
  • Google chrome official channel
  • A bunch of different browser args (see in

Additional context

No response

Environment

System:
    OS: Linux 6.5 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (4) x64 AMD EPYC [7](https://github.com/jeff-an/playwright-shadow-dom-repro/actions/runs/12031941610/job/33542600882?pr=1#step:6:8)763 64-Core Processor
    Memory: 14.48 GB / 15.61 GB
    Container: Yes
  Binaries:
    Node: 20.1[8](https://github.com/jeff-an/playwright-shadow-dom-repro/actions/runs/12031941610/job/33542600882?pr=1#step:6:9).1 - /opt/hostedtoolcache/node/20.18.1/x64/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: [10](https://github.com/jeff-an/playwright-shadow-dom-repro/actions/runs/12031941610/job/33542600882?pr=1#step:6:11).8.2 - /opt/hostedtoolcache/node/20.18.1/x64/bin/npm
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
  npmPackages:
    @playwright/test: ^1.48.2 => 1.48.2

jeff-an avatar Nov 26 '24 13:11 jeff-an

Minmal reproduction: https://github.com/mxschmitt/playwright-shadow-dom-repro/tree/jeff/ext

It isn't related to https://github.com/microsoft/playwright/issues/33330 since removing the Emulation.setFocusEmulationEnabled call does't fix it in that case. Also running it headed doesn't make it work

mxschmitt avatar Nov 26 '24 20:11 mxschmitt

ok so with headless=new, this problem still exists on 1.52.0 on linux. but there is an additional problem: the setup also no longer works on my Mac locally either.

on my local mac, instead of timing out, randomly the screen will flicker (it seems like the screenshot might be resetting device emulation settings or something like that) and sometimes the screen will not return to its original aspect ratio.

tested on chromium (new headless) and google chrome (new headless) with screencast on

jeff-an avatar Apr 24 '25 23:04 jeff-an

Fixed by https://github.com/microsoft/playwright/pull/37201.

dgozman avatar Sep 24 '25 16:09 dgozman

thanks so much!

jeff-an avatar Sep 24 '25 17:09 jeff-an