[BUG] chromium and webkit screenshot ignoring screenshot: clip: height option property
See original GitHub issueContext:
- Playwright Version: 0.11.1
- Operating System: Mac OS X 10.14.6
- Extra: node@11.15.0 npm@6.7.0
Code Snippet Full repo: https://github.com/aesyondu/javascript-questions/tree/tmp/playwright-sample
Specific commit: https://github.com/aesyondu/javascript-questions/commit/4d9b189d808ea69945fc3f7fa4e8fc293c0fac48
index.js
const path = require("path")
const { firefox } = require("playwright-firefox");
const { chromium } = require("playwright-chromium");
const { webkit } = require("playwright-webkit");
(async () => {
const browser = await firefox.launch({ headless: false })
// const browser = await chromium.launch({ headless: false })
// const browser = await webkit.launch({ headless: false })
const context = await browser.newContext()
context.setDefaultTimeout(9999999)
const page = await context.newPage()
await page.goto(`file:${path.join(__dirname, "index.html")}`) // 2. firefox not resolving page.goto file:
console.log("FIREFOX not outputting this")
const question = await page.$("h6[id^='1']")
const {x: xStart, y: yStart, width: widthStart} = await question.boundingBox()
const limit = await page.$("h6[id^='2']")
const {x: xEnd, y: yEnd} = await limit.boundingBox()
const heightCalc = yEnd - yStart
const heightCalc2 = (yEnd - yStart) * 2
console.log(yStart, yEnd, heightCalc)
await page.screenshot({
clip: {
x: xStart,
y: yStart,
width: widthStart,
height: 1000, // 2. chromium and webkit not using the height here
},
// path: "./chromium.png",
path: "./webkit.png",
})
console.log("FINISH")
await browser.close()
})()
Describe the bug Using screenshot: clip: height, the height is ignored, and is capped at 177px. However, if I change it to height: 10, it becomes 10px.
Couldn’t test with firefox due to the page.goto: file
bug. It’s already reported.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
719334 - Full size screenshot truncated at the height of 16384px
What is the expected behavior? Chrome captures a screenshot whose width and height are the same as the ones the page has. What...
Read more >Changelog - Cypress Documentation
The cy.mount() snapshot now shows the mounted component instead of a blank page. ... Cypress no longer throws the error "cannot read property...
Read more >WebView - Android Developers
HARDWARE bitmaps, real-time shadows, and outline clipping. For screenshots of the UI for feedback reports or unit testing the PixelCopy API is recommended....
Read more >Page.screenshot() method - Puppeteer
Remarks. Options object which might have the following properties: path : The file path to save the image to. The screenshot type ...
Read more >Puppeteer documentation - DevDocs
Puppeteer Documentation. Overview. Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol. The ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, poked at it. Thank you for a nice repo with the script.
clip
and theviewport
. In your case, height was falling off the viewport and hence was ignoredscrollIntoViewIfNeeded
is that it centers the element and you can’t center both start of the topic and the end of the topic - something goes behind the viewportWe will hunt all three problems to make sure it works as expected.
For now,
elementHandle.screenshot
is your best friend since we scroll, resize the viewport and do everything it takes to capture it. Action item for ourselves here is to makeclip
work the same way instead of intersecting with the viewport.Following worked for me on 0.11.1 on Firefox and WebKit. Chromium made first 14 snippets. I guess you can delete them dynamically to capture all in Chromium as well.
Ah, I think I understand what you are doing - you need a whole section. Let me see if we can help you here.