Puppeteer簡介


Puppeteer是一個node庫,他提供了一組用來操縱Chrome的API(默認headless也就是無UI的chrome,也可以配置為有UI)
Puppeteer(中文翻譯”木偶”) 是 Google Chrome 團隊官方的無界面(無頭或無腦Headless)Chrome 工具,它是一個 Node 庫,提供了一個高級的 API 來控制 DevTools協議上的無頭版 Chrome 。也可以配置為使用完整(非無頭)的 Chrome。Chrome 素來在瀏覽器界穩執牛耳,因此,Chrome Headless 必將成為 web 應用自動化測試的行業標桿。使用 Puppeteer,相當於同時具有 Linux 和 Chrome 雙端的操作能力,應用場景可謂非常之多。此倉庫的建立,即是嘗試各種折騰使用 GoogleChrome Puppeteer;以期在好玩的同時,學到更多有意思的操作。
作用和Selenium相似,但是不能跨平台,只能用在chrome做自動化測試
官網:
大綱:
  • Installation
  • Usage
  • Default runtime settings
  • API Documentation
  • Debugging tips
  • FAQ
Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?
Selenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.
Puppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.
Puppeteer bundles the latest versions of Chromium.
Q: Why is the Chrome team building Puppeteer?
The goals of the project are simple:
  • Provide a slim, canonical library that highlights the capabilities of the DevTools Protocol.
  • Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.
  • Grow the adoption of headless/automated browser testing.
  • Help dogfood new DevTools Protocol features...and catch bugs!
  • Learn more about the pain points of automated browser testing and help fill those gaps.
 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM