Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { chromium } = require(“playwright”);
- (async () => {
- // Launch the Chromium browser
- const browser = await chromium.launch();
- const context = await browser.newContext({
- userAgent: “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/109.0”,
- });
- // Create a new page in the browser context and navigate to target URL
- const page = await context.newPage();
- await page.goto(“https://httpbin.io/user-agent”);
- // Get the entire page content
- const pageContent = await page.content();
- console.log(pageContent);
- // Close the browser
- await browser.close();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement