中文文档
https://puppeteer-china.github.io/
仓库
https://github.com/puppeteer/puppeteer
jquery api的使用puppeteer-jquery
https://www.npmjs.com/package/puppeteer-jquery
const $jquery = require("puppeteer-jquery");
const {pageExtend, PageEx} = $jquery;
let browser = await launch({headless: true});
let pageOrg = await browser.newPage();
let page = pageExtand(pageOrg);
// append a <H1>
await page.jQuery('body').append(`<h1>Title</h1>`);
// get the H1 value
let title = await page.jQuery('h1').text();
// chain calls
let text = await page.jQuery('body button:last')
.closest('div')
.find('h3')
.css('color', 'yellow')
.parent()
.find(':last')
.text()
;
网友评论