puppeteerでリンク全部取得

qiita.com

const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto('https://www.yahoo.co.jp/');

    const hrefs = await page.$$eval('a', hrefs => hrefs.map((a) => {
        return a.href
    }));

    console.log(hrefs);

    await browser.close();
})();
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://www.yahoo.co.jp/');

  const datas = await page.$$eval('a', list => list.map(item => item.href));

  console.log(datas);

  await browser.close();
})();