Puppeteer log inside page.evaluate

后端 未结 10 1009
野的像风
野的像风 2020-12-01 04:34

How can I console.log something inside the page.evaluate, passing it to node and using it during the evaluation of the page?

I actually want to log

10条回答
  •  北海茫月
    2020-12-01 05:02

    I share this solution for future readers who would more like to know how to get the returned value of an evaluation instead.

    const element = await page.$("a selector");
    const text = await page.evaluate(element => element.textContent);
    

提交回复
热议问题