const playwright = require('playwright');

let url = ``; 
let argv = proces.argv.slice(2);
url = argv.shift();
if( /[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/.test(url) ) {
    console.log(`valid`);
}

(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);

  await page.getByPlaceholder('検索').click();
  await page.getByPlaceholder('検索').fill('鳥インフルエンザ');
  await page.getByPlaceholder('検索').press('Enter');
  await page.waitForTimeout(1000);
  //screenshot
  var date = Date.now();
  await page.screenshot({path: `${date}.png`});

  await browser.close();

  })();
Edit
Pub: 04 Feb 2023 11:48 UTC
Edit: 05 Feb 2023 10:43 UTC
Views: 64