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
Feature request: original HTML content ('View Page Source') #749
Comments
How about this: const puppeteer = require('puppeteer');
puppeteer.launch().then(async browser => {
const page = await browser.newPage();
const url = 'https://www.chromestatus.com/features';
page.on('response', async resp => {
if (resp.ok && resp.url === url) {
console.log(await resp.text());
}
});
await page.goto(url);
browser.close();
}); Alternatively, you don't really need Puppeteer for this: const https = require('https');
https.get('https://www.chromestatus.com/features', resp => {
let data = '';
resp.on('data', (chunk) => data += chunk);
resp.on('end', () => console.log(data));
}); |
@datasunny: just use the main resource response to retrieve content: const puppeteer = require('puppeteer');
puppeteer.launch().then(async browser => {
const page = await browser.newPage();
const response = await page.goto('https://www.chromestatus.com/features');
console.log(await response.text());
browser.close();
}); |
@aslushnikov nice. Forgot |
Thanks all for the lighting fast response! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New feature request: adding a new method to retrieve original HTML content of a web page (before Javascript rendering), just like in Chrome browser, right click mouse and choose 'View Page Source'.
The text was updated successfully, but these errors were encountered: