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.
 
 
posted @ 2019-06-03 19:33  HenryZ.Tang  阅读(1135)  评论(0编辑  收藏  举报