/**
* node.js から playwright での chrome ブラウザ操作テスト
**/

const playwright = require('playwright');

const url = "https://www.youtube.com/";

(async () => {
  const browser = await playwright.chromium.launch({
    channel: 'chrome',headless : false,
  });

  //context
  const context = await browser.newContext();
  //page
  const page = await context.newPage();
  //navigate
  await page.goto(url);
  var date = Date.now();
  //screenshot
  await page.screenshot({path: `${date}.png`});

  await browser.close();

  })();
Edit
Pub: 04 Feb 2023 11:50 UTC
Views: 43