| OLD | NEW | 
|    1 # Headless Chromium |    1 # Headless Chromium | 
|    2  |    2  | 
|    3 Headless Chromium allows running Chromium in a headless/server environment. |    3 Headless Chromium allows running Chromium in a headless/server environment. | 
|    4 Expected use cases include loading web pages, extracting metadata (e.g., the |    4 Expected use cases include loading web pages, extracting metadata (e.g., the | 
|    5 DOM) and generating bitmaps from page contents -- using all the modern web |    5 DOM) and generating bitmaps from page contents -- using all the modern web | 
|    6 platform features provided by Chromium and Blink. |    6 platform features provided by Chromium and Blink. | 
|    7  |    7  | 
|    8 There are two ways to use Headless Chromium: |    8 There are two ways to use Headless Chromium: | 
|    9  |    9  | 
|   10 ## Usage via the DevTools remote debugging protocol |   10 ## Usage via the DevTools remote debugging protocol | 
|   11  |   11  | 
|   12 1. Start a normal Chrome binary with the `--headless` command line flag |   12 1. Start a normal Chrome binary with the `--headless` command line flag | 
|   13 (Linux-only for now): |   13 (Linux-only for now): | 
|   14  |   14  | 
|   15 ``` |   15 ``` | 
|   16 $ chrome --headless --remote-debugging-port=9222 https://chromium.org |   16 $ chrome --headless --remote-debugging-port=9222 https://chromium.org | 
|   17 ``` |   17 ``` | 
|   18  |   18  | 
|   19 Currently you'll also need to use `--disable-gpu` to avoid an error from a |   19 Currently you'll also need to use `--disable-gpu` to avoid an error from a | 
|   20 missing Mesa library. |   20 missing Mesa library. | 
|   21  |   21  | 
|   22 2. Navigate to `http://localhost:9222` in another browser to open the |   22 2. Navigate to `http://localhost:9222` in another browser to open the | 
|   23 [DevTools](https://developer.chrome.com/devtools) interface or use a tool such |   23 [DevTools](https://developer.chrome.com/devtools) interface or use a tool such | 
|   24 as [Selenium](http://www.seleniumhq.org/) to drive the headless browser. |   24 as [Selenium](http://www.seleniumhq.org/) to drive the headless browser. | 
|   25  |   25  | 
 |   26 ## Usage from Node.js | 
 |   27  | 
 |   28 For example, the [chrome-remote-interface](https://github.com/cyrus-and/chrome-r
     emote-interface) | 
 |   29 Node.js package can be used to extract a page's DOM like this: | 
 |   30  | 
 |   31 ``` | 
 |   32 const CDP = require('chrome-remote-interface'); | 
 |   33  | 
 |   34 CDP((client) => { | 
 |   35   // Extract used DevTools domains. | 
 |   36   const {Page, Runtime} = client; | 
 |   37  | 
 |   38   // Enable events on domains we are interested in. | 
 |   39   Promise.all([ | 
 |   40     Page.enable() | 
 |   41   ]).then(() => { | 
 |   42     return Page.navigate({url: 'https://example.com'}); | 
 |   43   }); | 
 |   44  | 
 |   45   // Evaluate outerHTML after page has loaded. | 
 |   46   Page.loadEventFired(() => { | 
 |   47     Runtime.evaluate({expression: 'document.body.outerHTML'}).then((result) => { | 
 |   48       console.log(result.result.value); | 
 |   49       client.close(); | 
 |   50     }); | 
 |   51   }); | 
 |   52 }).on('error', (err) => { | 
 |   53   console.error('Cannot connect to browser:', err); | 
 |   54 }); | 
 |   55 ``` | 
 |   56  | 
|   26 ## Usage as a C++ library |   57 ## Usage as a C++ library | 
|   27  |   58  | 
|   28 Headless Chromium can be built as a library for embedding into a C++ |   59 Headless Chromium can be built as a library for embedding into a C++ | 
|   29 application. This approach is otherwise similar to controlling the browser over |   60 application. This approach is otherwise similar to controlling the browser over | 
|   30 a DevTools connection, but it provides more customization points, e.g., for |   61 a DevTools connection, but it provides more customization points, e.g., for | 
|   31 networking and [mojo services](https://docs.google.com/document/d/1Fr6_DJH6OK9rG
     3-ibMvRPTNnHsAXPk0VzxxiuJDSK3M/edit#heading=h.qh0udvlk963d). |   62 networking and [mojo services](https://docs.google.com/document/d/1Fr6_DJH6OK9rG
     3-ibMvRPTNnHsAXPk0VzxxiuJDSK3M/edit#heading=h.qh0udvlk963d). | 
|   32  |   63  | 
|   33 [Headless Example](https://cs.chromium.org/chromium/src/headless/app/headless_ex
     ample.cc) |   64 [Headless Example](https://cs.chromium.org/chromium/src/headless/app/headless_ex
     ample.cc) | 
|   34 is a small sample application which demonstrates the use of the headless C++ |   65 is a small sample application which demonstrates the use of the headless C++ | 
|   35 API. It loads a web page and outputs the resulting DOM. To run it, first |   66 API. It loads a web page and outputs the resulting DOM. To run it, first | 
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  100 * [Runtime headless mode for Chrome](https://docs.google.com/document/d/1aIJUzQr
     3eougZQp90bp4mqGr5gY6hdUice8UPa-Ys90/edit#) |  131 * [Runtime headless mode for Chrome](https://docs.google.com/document/d/1aIJUzQr
     3eougZQp90bp4mqGr5gY6hdUice8UPa-Ys90/edit#) | 
|  101 * [Virtual Time in Blink](https://docs.google.com/document/d/1y9kdt_zezt7pbey6uz
     vt1dgklwc1ob_vy4nzo1zbqmo/edit#heading=h.tn3gd1y9ifml) |  132 * [Virtual Time in Blink](https://docs.google.com/document/d/1y9kdt_zezt7pbey6uz
     vt1dgklwc1ob_vy4nzo1zbqmo/edit#heading=h.tn3gd1y9ifml) | 
|  102 * [Headless Chrome architecture](https://docs.google.com/document/d/11zIkKkLBoco
     fGgoTeeyibB2TZ_k7nR78v7kNelCatUE/edit) |  133 * [Headless Chrome architecture](https://docs.google.com/document/d/11zIkKkLBoco
     fGgoTeeyibB2TZ_k7nR78v7kNelCatUE/edit) | 
|  103 * [Headless Chrome C++ DevTools API](https://docs.google.com/document/d/1rlqcp8n
     k-ZQvldNJWdbaMbwfDbJoOXvahPCDoPGOwhQ/edit#heading=h.ng2bxb15li9a) |  134 * [Headless Chrome C++ DevTools API](https://docs.google.com/document/d/1rlqcp8n
     k-ZQvldNJWdbaMbwfDbJoOXvahPCDoPGOwhQ/edit#heading=h.ng2bxb15li9a) | 
|  104 * [Session isolation in Headless Chrome](https://docs.google.com/document/d/1XAK
     vrxtSEoe65vNghSWC5S3kJ--z2Zpt2UWW1Fi8GiM/edit) |  135 * [Session isolation in Headless Chrome](https://docs.google.com/document/d/1XAK
     vrxtSEoe65vNghSWC5S3kJ--z2Zpt2UWW1Fi8GiM/edit) | 
|  105 * [Headless Chrome mojo service](https://docs.google.com/document/d/1Fr6_DJH6OK9
     rG3-ibMvRPTNnHsAXPk0VzxxiuJDSK3M/edit#heading=h.qh0udvlk963d) |  136 * [Headless Chrome mojo service](https://docs.google.com/document/d/1Fr6_DJH6OK9
     rG3-ibMvRPTNnHsAXPk0VzxxiuJDSK3M/edit#heading=h.qh0udvlk963d) | 
|  106 * [Controlling BeginFrame through DevTools](https://docs.google.com/document/d/1
     LVMYDkfjrrX9PNkrD8pJH5-Np_XUTQHIuJ8IEOirQH4/edit?ts=57d96dbd#heading=h.ndv831lc9
     uf0) |  137 * [Controlling BeginFrame through DevTools](https://docs.google.com/document/d/1
     LVMYDkfjrrX9PNkrD8pJH5-Np_XUTQHIuJ8IEOirQH4/edit?ts=57d96dbd#heading=h.ndv831lc9
     uf0) | 
|  107 * [Viewport bounds and scale for screenshots](https://docs.google.com/document/d
     /1VTcYz4q_x0f1O5IVrvRX4u1DVd_K34IVUl1VULLTCWw/edit#heading=h.ndv831lc9uf0) |  138 * [Viewport bounds and scale for screenshots](https://docs.google.com/document/d
     /1VTcYz4q_x0f1O5IVrvRX4u1DVd_K34IVUl1VULLTCWw/edit#heading=h.ndv831lc9uf0) | 
|  108 * [BlinkOn 6 presentation slides](https://docs.google.com/presentation/d/1gqK9F4
     lGAY3TZudAtdcxzMQNEE7PcuQrGu83No3l0lw/edit#slide=id.p) |  139 * [BlinkOn 6 presentation slides](https://docs.google.com/presentation/d/1gqK9F4
     lGAY3TZudAtdcxzMQNEE7PcuQrGu83No3l0lw/edit#slide=id.p) | 
|  109 * [Architecture design doc](https://docs.google.com/document/d/11zIkKkLBocofGgoT
     eeyibB2TZ_k7nR78v7kNelCatUE) |  140 * [Architecture design doc](https://docs.google.com/document/d/11zIkKkLBocofGgoT
     eeyibB2TZ_k7nR78v7kNelCatUE) | 
| OLD | NEW |