From b522ecaa6547f4ade70e6a336c0ebb147b8e9a84 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Fri, 25 May 2018 16:47:15 -0700 Subject: [PATCH] docs(api.md): update puppeteer overview (#2584) Puppeteer tip-of-tree includes both workers and browser contexts. --- docs/api.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/api.md b/docs/api.md index bb77a25d..75ee60fe 100644 --- a/docs/api.md +++ b/docs/api.md @@ -277,14 +277,18 @@ Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol. -The Puppeteer API is hierarchical and mirrors the browser structure. On the following diagram, faded entities are not currently represented in Puppeteer. +The Puppeteer API is hierarchical and mirrors the browser structure. -![puppeteer overview](https://user-images.githubusercontent.com/746130/38952006-1c3c9c16-42ff-11e8-93af-e498076f28b4.png) +> **NOTE** On the following diagram, faded entities are not currently represented in Puppeteer. + +![puppeteer overview](https://user-images.githubusercontent.com/746130/40333229-5df5480c-5d0c-11e8-83cb-c3e371de7374.png) - [`Puppeteer`](#class-puppeteer) communicates with the browser using [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). -- [`Browser`](#class-browser) instance can own multiple pages. +- [`Browser`](#class-browser) instance can own multiple browser contexts. +- [`BrowserContext`](#class-browsercontext) instance defines a browsing session and can own multiple pages. - [`Page`](#class-page) has at least one frame: main frame. There might be other frames created by [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) or [frame](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/frame) tags. - [`Frame`](#class-frame) has at least one execution context - the default execution context - where the frame's JavaScript is executed. A Frame might have additional execution contexts that are associated with [extensions](https://developer.chrome.com/extensions). +- [`Worker`](#class-worker) has a single execution context and and facilitates interacting with [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). (Diagram source: [link](https://docs.google.com/drawings/d/1Q_AM6KYs9kbyLZF-Lpp5mtpAWth73Cq8IKCsWYgi8MM/edit?usp=sharing))