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
how can I make same behavior of CTRL + S? #592
Comments
(link puppeteer/puppeteer#2433) There is no generic MHTML generation across browsers yet, but you can still opt into using raw CDP as you do in Puppeteer: 'use strict';
const pw = require('playwright');
const fs = require('fs');
(async () => {
const browser = await pw.chromium.launch();
const context = await browser.newContext();
const page = await context.newPage('https://en.wikipedia.org/wiki/MHTML');
// There is no generic mhtml functionality in WebKit / Firefox atm.
// Chromium-specific CDP accessor is now on the Browser-level.
const cdp = await browser.pageTarget(page).createCDPSession();
const { data } = await cdp.send('Page.captureSnapshot', { format: 'mhtml' });
fs.writeFileSync('page.mhtml', data);
await browser.close();
})(); |
Closing this for now. Note that it is unlikely that we can make it a part of the cross-browser API due to the lack of MHTML in Firefox. But if you have ideas on how this could be achieved cross-browser yourself, please let us know! |
Playwright 1.7.0 import {chromium} from 'playwright';
import {writeFile} from 'fs/promises';
(async () => {
const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://en.wikipedia.org/wiki/MHTML');
const cdp = await context.newCDPSession(page);
const {data} = await cdp.send('Page.captureSnapshot', {format: 'mhtml'});
await writeFile('page.mhtml', data);
await browser.close();
})(); |
sand4rt
pushed a commit
to sand4rt/playwright
that referenced
this issue
Dec 21, 2022
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
Thanks for doing this, I used puppeteer in past and can't wait to use this. I want to do save content of web page I'm currently visit and all related content (css, js, etc) like hit the ctrl + s on a browser ?
If question wasn't clear ( see this: pupeteer/issues/2433)
Thanks 😀
The text was updated successfully, but these errors were encountered: