node js puppeteer metadata

余生长醉 提交于 2019-12-05 21:41:42

You need a deep tutorial for CSS selectors MDN CSS Selectors.

Something that I highly recommend is testing your selectors on the console directly in the page you will apply the automation, this will save hours of running-stop your system. Try this:

document.querySelectorAll("head > meta[name='description']")[0].content;

Now for puppeteer, you need to copy that selector and past on puppeteer function also I like more this notation:

await page.$eval("head > meta[name='description']", element => element.content);

Any other question or problem just comment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!