New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Devtools resize viewport dimensions overlay included in screenshots #6819
Comments
Maksim, could you PTAL? Looks like the overlay (cc @OrKoN) shows up. |
The viewport size overlay is shown when you resize the window and have DevTools opened. So I wonder if it's a regression issue? Maybe the capturing of a screenshot causes the window to resize now. |
Can confirm that this issue is not present in |
@sadym-chromium PTAL then. Also, when a screenshot is taken via DevTools, DevTools disables all overlays so perhaps Puppeteers implementation should do the same? |
On it |
Confirmed. I was able to reproduce and to add an automated test for it. Looking into solving the issue. |
It looks like the issue is with having 2 Overlay agents controlling Overlays. One from the DevTools session, another from the Puppeteer session. The question is should the Overlay be a global or should we stick to the current behaviour having an overlay manager per CDP session. Having singleton Overlay Manager: Pros:
Cons:
I personally inclined to keep the Overlay per-session. @jschfflr, @mathiasbynens, @OrKoN, @marvinhagemeister |
I think we should keep the overlay agents created per session unless it's the only solution. |
@marvinhagemeister could you please clarify the business case why the screenshot with open DevTools is needed? |
@sadym-chromium Sure! We've build a complete test runner around puppeteer over at https://github.com/boxine/pentf/ . To make test inspection as easy as possible for our developers we have a For most type of screenshots the additional overlay from devtools doesn't matter, but it get's very annoying when it comes to visual regression testing. It works by taking a screenshot of the current page and comparing it to a previous one and highlighting the differences. The devtools overlay causes a mismatch leading to test failures. I'm happy with directly messaging with the devtools client like in the linked PR, if this issue is not seen as worthy enough to be fixed in |
A bit of implementation details explaining what is going on under the hood:
As you see, the problem cannot be solved by the Puppeteer itself. There are few potential solutions:
|
@sadym-chromium I am still seeing the resize overlay in the screenshots after setting Overlay.setShowViewportSizeOnResize: const session = await page.target().createCDPSession();
await session.send('Overlay.setShowViewportSizeOnResize', { show: false }); I didn't fully understand your comment explaining what is happening when the screenshot is taken, is there a different workaround that I could use to make the resize indicator go away? |
The issue can be solved by rolling back to previous behaviour. To do so, you should pass argument |
Feel free to reopen the issue if the approach doesn't work for you. |
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
example.png
What is the expected result?
What happens instead?
Notice the viewport dimensions in the top right corner of the screenshot. I expect them not to be there. They are seemingly injected by the devtools somehow. They are not present when the devtools panel isn't open. Doesn't seem to be injected into the pages HTML either, otherwise I'd be able to hide it via CSS or something.
The text was updated successfully, but these errors were encountered: