Skip to content
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

[BUG]Screenshot quality parameter setting error #4811

Closed
jhjade opened this issue Dec 23, 2020 · 2 comments
Closed

[BUG]Screenshot quality parameter setting error #4811

jhjade opened this issue Dec 23, 2020 · 2 comments
Assignees

Comments

@jhjade
Copy link

jhjade commented Dec 23, 2020

Context:

  • Playwright Version: [1.7.1]
  • Operating System: [ Windows10]
  • Node.js version: [v12.13.1]
  • Browser: [All]
  • Extra: []

Code Snippet

const { chromium, firefox, webkit } = require('playwright') 

;(async () => {
  const browser = await firefox.launch()
  const page = await browser.newPage()
  await page.goto('https://www.cnblogs.com/cmt/p/14109447.html')
  //https://playwright.dev/docs/api/class-page#pagescreenshotoptions
  await page.screenshot({
    path: `example.png`,
    fullPage: true,
    quality: 20, // The quality of the image, between 0-100. Not applicable to png images
    type: 'png',
  })
  await browser.close()
  console.log('success')
})()

Describe the bug

An exception occurs when the quality setting is greater than 0
微信截图_20201223111136

微信截图_20201223111136

@jhjade jhjade changed the title [BUG] [BUG]Screenshot quality parameter setting error Dec 23, 2020
@yury-s
Copy link
Member

yury-s commented Dec 23, 2020

You should omit quality option completely as it only makes sense for jpg screenshots. I'll update the code to throw the same error when quality is 0.

@jhjade
Copy link
Author

jhjade commented Dec 23, 2020

You should omit quality option completely as it only makes sense for jpg screenshots. I'll update the code to throw the same error when quality is 0.

Sorry, it is my problem. Did not pay attention to the parameter description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants