lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

Screenshots with Puppeteer have incorrect dimensions

Open adamraine opened this issue 4 years ago • 3 comments

https://github.com/GoogleChrome/lighthouse/pull/12973#discussion_r696889448

Full page screenshot looks ok, but the timeline view has incorrect dimensions: Screen Shot 2021-08-26 at 4 00 51 PM

Edit: current workaround for Puppeteer is to use ignoreDefaultArgs: ['--enable-automation']

await puppeteer.launch({
  ignoreDefaultArgs: ['--enable-automation'],
});

Edit2: The above workaround isn't enough if you are using Chrome for testing which Puppeteer uses by default now. You can specify a path to a normal Chrome executable as a workaround:

await puppeteer.launch({
  ignoreDefaultArgs: ['--enable-automation'],
  executablePath: '/path/to/chrome'
});

adamraine avatar Aug 26 '21 20:08 adamraine

This is due to the infobar from --enable-automation when launched with puppeteer by default, and cannot be solved without changes in Chromium. The various workarounds mentioned in https://github.com/puppeteer/puppeteer/issues/2070 all devolve into just dropping the --enable-automation flag which we do otherwise want.

Ideal situation:

  1. trace screenshots are fixed to ignore the infobar area
  2. we get --disable-infobars back which can truly disable this

patrickhulce avatar Sep 08 '21 20:09 patrickhulce

I opened https://bugs.chromium.org/p/chromium/issues/detail?id=1277272 to see if we can get the ball rolling on option 1.

adamraine avatar Dec 06 '21 23:12 adamraine

Update --disable-infobars is returning but only for Chrome for Testing: https://bugs.chromium.org/p/chromium/issues/detail?id=1476789

adamraine avatar Aug 29 '23 21:08 adamraine