0
0

More than 1 year has passed since last update.

【Puppeteer】スクリーンショットを撮る/ページのソースを取得する方法

Posted at

Puppeteerを使用する機会がありました。

デバッグの際、以下の2つのコマンドがすごく便利だったのでメモしておきます。

スクリーンショットを撮る

await page.screenshot({ path: 'screenshot.png' });

ページのソースを取得する

const bodyHandle = await page.$('body');
const html = await page.evaluate((body) => body.innerHTML, bodyHandle);
console.log(html);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0