puppeteer recorder使用说明
发布网友
发布时间:2023-03-17 09:57
我来回答
共1个回答
热心网友
时间:2023-11-02 22:55
项目地址: https://github.com/checkly/puppeteer-recorder
官网插件描述:
Chrome extension for recording browser interaction and generating Puppeteer scripts
Puppeteer recorder is a Chrome extension that records your browser interactions and generates a Puppeteer script.
Writing Puppeteer scripts for scraping, testing and monitoring can be tricky. A recorder / code generator can be helpful. This extension has the following features:
This extension is actively developed. More events and actions will be added in later versions.
安装
进入Chrome web store
查找puppeteer recorder
add to chrome
在bing中输入puppeteer,点击search,点击第一个链接
停止
await page.setViewport({ width: 991, height: 618 })
await page.goto(' https://cn.bing.com/?scope=web&FORM=QBRE' )
await page.waitForSelector('#sbox > .search_controls > #sb_form > .b_searchboxForm > #sb_form_go')
await page.click('#sbox > .search_controls > #sb_form > .b_searchboxForm > #sb_form_go')
const navigationPromise = page.waitForNavigation()
await navigationPromise
await page.waitForSelector('.b_algo:nth-child(1) > .b_title > h2 > a > strong')
await page.click('.b_algo:nth-child(1) > .b_title > h2 > a > strong')
await navigationPromise
await browser.close()
})()