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

[Question] page.screenshot 'encoding' option has been dismissed? #1294

Closed
hdorgeval opened this issue Mar 9, 2020 · 2 comments · Fixed by #1302
Closed

[Question] page.screenshot 'encoding' option has been dismissed? #1294

hdorgeval opened this issue Mar 9, 2020 · 2 comments · Fixed by #1302

Comments

@hdorgeval
Copy link
Contributor

The page.screenshot() method used to have an encoding option.
I saw that this option has been removed, but there is one test that may indicate that this 'encoding' option is a non documented feature:

screenshot.spec.js

it('should return base64', async({page, server}) => {
      await page.setViewportSize({width: 500, height: 500});
      await page.goto(server.PREFIX + '/grid.html');
      const screenshot = await page.screenshot({
        encoding: 'base64'
      });
      expect(Buffer.from(screenshot, 'base64')).toBeGolden('screenshot-sanity.png');
    });

So my question is: is this test obsolete, or is the encoding option a non documented feature?

@aslushnikov
Copy link
Collaborator

@hdorgeval yeah this is a stray test; there's no more option any more.

If you need the option, It is easily polifilable:

const base64 = (await page.screenshot()).toString('base64');

I'll follow-up with test removal

aslushnikov added a commit to aslushnikov/playwright that referenced this issue Mar 9, 2020
aslushnikov added a commit that referenced this issue Mar 10, 2020
@hdorgeval
Copy link
Contributor Author

Hi @aslushnikov, thank you very much for your feedback.

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

Successfully merging a pull request may close this issue.

2 participants