Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const puppeteer = require('puppeteer');
- const fs = require('fs'); // Require the Node.js 'fs' module to work with files
- (async () => {
- // Launch a headless browser
- const browser = await puppeteer.launch();
- // Open a new page
- const page = await browser.newPage();
- // Navigate to Google
- await page.goto('https://www.google.com');
- // Get the page's HTML content
- const html = await page.content();
- // Save the HTML content to a file
- fs.writeFileSync('google.html', html, 'utf-8');
- // Close the browser when done
- await browser.close();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement