puppeteer recorder使用說(shuō)明

項(xiàng)目地址:https://github.com/checkly/puppeteer-recorder
官網(wǎng)插件描述:
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:

  • Record clicks, input events etc.
  • Pause the recording when navigating.
  • Monitor recorded events.
  • Export to Puppeteer code.
  • Tweak the settings of the generated code.

This extension is actively developed. More events and actions will be added in later versions.

安裝
進(jìn)入Chrome web store
查找puppeteer recorder


image.png

add to chrome

添加成功后出現(xiàn)
image.png

錄制
打開(kāi)開(kāi)始錄制
image.png

執(zhí)行

在bing中輸入puppeteer,點(diǎn)擊search,點(diǎn)擊第一個(gè)鏈接
停止


image.png

錄制的腳本如下:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()

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()
})()

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • This project was bootstrapped with Create React App. Belo...
    unspecx閱讀 5,311評(píng)論 0 2
  • 你以為一切都是沒(méi)選好 得到的和想要的對(duì)不上號(hào) 你以為時(shí)間可以重來(lái) 換個(gè)人當(dāng)主角 愛(ài)情就會(huì)天荒地老 你不知世界上誰(shuí)對(duì)...
    上官南929閱讀 375評(píng)論 1 2
  • 1 抑郁是對(duì)自己、對(duì)生活評(píng)價(jià)很低,并對(duì)自己的前途感到悲觀失望的消極心理。 2 抑郁采用正確的方法和藥物進(jìn)行治療,完...
    晴晴愛(ài)穎穎閱讀 950評(píng)論 0 2
  • 春:散文隨筆&談寫(xiě)作專題征文 做過(guò)很多很多的夢(mèng),同時(shí)也忘記過(guò)很多很多的夢(mèng)。十有八九,大多數(shù)的夢(mèng)總是在醒來(lái)那一瞬間消...
    昇夫閱讀 785評(píng)論 6 12
  • 今天別忘記剃頭發(fā)呀??!以前流行在頭上扣個(gè)碗,沿著碗邊剪,成品就是西瓜太郎那樣的發(fā)型。 嗯,一會(huì)也要給梨貓和小耳朵剃頭啦
    飛客流依閱讀 320評(píng)論 1 2

友情鏈接更多精彩內(nèi)容