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 |
(...skipping 12 matching lines...) Expand all Loading... |
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 as a C++ library | 26 ## Usage as a C++ library |
27 | 27 |
28 Headless Chromium can be built as a library for embedding into a C++ | 28 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 | 29 application. This approach is otherwise similar to controlling the browser over |
30 a DevTools connection, but it provides more customization points, e.g., for | 30 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). | 31 networking and [mojo services](https://docs.google.com/document/d/1Fr6_DJH6OK9rG
3-ibMvRPTNnHsAXPk0VzxxiuJDSK3M/edit#heading=h.qh0udvlk963d). |
32 | 32 |
33 Headless Shell is a sample application which demonstrates the use of the | 33 [Headless Example](https://cs.chromium.org/chromium/src/headless/app/headless_ex
ample.cc) |
34 headless C++ API. To run it, first initialize a headless build configuration: | 34 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 |
| 36 initialize a headless build configuration: |
35 | 37 |
36 ``` | 38 ``` |
37 $ mkdir -p out/Debug | 39 $ mkdir -p out/Debug |
38 $ echo 'import("//build/args/headless.gn")' > out/Debug/args.gn | 40 $ echo 'import("//build/args/headless.gn")' > out/Debug/args.gn |
39 $ gn gen out/Debug | 41 $ gn gen out/Debug |
40 ``` | 42 ``` |
41 | 43 |
42 Then build the shell: | 44 Then build the example: |
| 45 |
| 46 ``` |
| 47 $ ninja -C out/Debug headless_example |
| 48 ``` |
| 49 |
| 50 After the build completes, the example can be run with the following command: |
| 51 |
| 52 ``` |
| 53 $ out/Debug/headless_example https://www.google.com |
| 54 ``` |
| 55 |
| 56 [Headless Shell](https://cs.chromium.org/chromium/src/headless/app/headless_shel
l.cc) |
| 57 is a more capable headless application. For instance, it supports remote |
| 58 debugging with the [DevTools](https://developer.chrome.com/devtools) protocol. |
| 59 To do this, start the application with an argument specifying the debugging |
| 60 port: |
43 | 61 |
44 ``` | 62 ``` |
45 $ ninja -C out/Debug headless_shell | 63 $ ninja -C out/Debug headless_shell |
46 ``` | |
47 | |
48 After the build completes, Headless Shell can be run with the following command: | |
49 | |
50 ``` | |
51 $ out/Debug/headless_shell https://www.google.com | |
52 ``` | |
53 | |
54 To attach a [DevTools](https://developer.chrome.com/devtools) debugger to the | |
55 shell, start it with an argument specifying the debugging port: | |
56 | |
57 ``` | |
58 $ out/Debug/headless_shell --remote-debugging-port=9222 https://youtube.com | 64 $ out/Debug/headless_shell --remote-debugging-port=9222 https://youtube.com |
59 ``` | 65 ``` |
60 | 66 |
61 Then navigate to `http://localhost:9222` with your browser. | 67 Then navigate to `http://localhost:9222` with your browser. |
62 | 68 |
63 ## Embedder API | 69 ## Embedder API |
64 | 70 |
65 The embedder API allows developers to integrate the headless library into their | 71 The embedder API allows developers to integrate the headless library into their |
66 application. The API provides default implementations for low level adaptation | 72 application. The API provides default implementations for low level adaptation |
67 points such as networking and the run loop. | 73 points such as networking and the run loop. |
(...skipping 26 matching lines...) Expand all Loading... |
94 * [Runtime headless mode for Chrome](https://docs.google.com/document/d/1aIJUzQr
3eougZQp90bp4mqGr5gY6hdUice8UPa-Ys90/edit#) | 100 * [Runtime headless mode for Chrome](https://docs.google.com/document/d/1aIJUzQr
3eougZQp90bp4mqGr5gY6hdUice8UPa-Ys90/edit#) |
95 * [Virtual Time in Blink](https://docs.google.com/document/d/1y9kdt_zezt7pbey6uz
vt1dgklwc1ob_vy4nzo1zbqmo/edit#heading=h.tn3gd1y9ifml) | 101 * [Virtual Time in Blink](https://docs.google.com/document/d/1y9kdt_zezt7pbey6uz
vt1dgklwc1ob_vy4nzo1zbqmo/edit#heading=h.tn3gd1y9ifml) |
96 * [Headless Chrome architecture](https://docs.google.com/document/d/11zIkKkLBoco
fGgoTeeyibB2TZ_k7nR78v7kNelCatUE/edit) | 102 * [Headless Chrome architecture](https://docs.google.com/document/d/11zIkKkLBoco
fGgoTeeyibB2TZ_k7nR78v7kNelCatUE/edit) |
97 * [Headless Chrome C++ DevTools API](https://docs.google.com/document/d/1rlqcp8n
k-ZQvldNJWdbaMbwfDbJoOXvahPCDoPGOwhQ/edit#heading=h.ng2bxb15li9a) | 103 * [Headless Chrome C++ DevTools API](https://docs.google.com/document/d/1rlqcp8n
k-ZQvldNJWdbaMbwfDbJoOXvahPCDoPGOwhQ/edit#heading=h.ng2bxb15li9a) |
98 * [Session isolation in Headless Chrome](https://docs.google.com/document/d/1XAK
vrxtSEoe65vNghSWC5S3kJ--z2Zpt2UWW1Fi8GiM/edit) | 104 * [Session isolation in Headless Chrome](https://docs.google.com/document/d/1XAK
vrxtSEoe65vNghSWC5S3kJ--z2Zpt2UWW1Fi8GiM/edit) |
99 * [Headless Chrome mojo service](https://docs.google.com/document/d/1Fr6_DJH6OK9
rG3-ibMvRPTNnHsAXPk0VzxxiuJDSK3M/edit#heading=h.qh0udvlk963d) | 105 * [Headless Chrome mojo service](https://docs.google.com/document/d/1Fr6_DJH6OK9
rG3-ibMvRPTNnHsAXPk0VzxxiuJDSK3M/edit#heading=h.qh0udvlk963d) |
100 * [Controlling BeginFrame through DevTools](https://docs.google.com/document/d/1
LVMYDkfjrrX9PNkrD8pJH5-Np_XUTQHIuJ8IEOirQH4/edit?ts=57d96dbd#heading=h.ndv831lc9
uf0) | 106 * [Controlling BeginFrame through DevTools](https://docs.google.com/document/d/1
LVMYDkfjrrX9PNkrD8pJH5-Np_XUTQHIuJ8IEOirQH4/edit?ts=57d96dbd#heading=h.ndv831lc9
uf0) |
101 * [Viewport bounds and scale for screenshots](https://docs.google.com/document/d
/1VTcYz4q_x0f1O5IVrvRX4u1DVd_K34IVUl1VULLTCWw/edit#heading=h.ndv831lc9uf0) | 107 * [Viewport bounds and scale for screenshots](https://docs.google.com/document/d
/1VTcYz4q_x0f1O5IVrvRX4u1DVd_K34IVUl1VULLTCWw/edit#heading=h.ndv831lc9uf0) |
102 * [BlinkOn 6 presentation slides](https://docs.google.com/presentation/d/1gqK9F4
lGAY3TZudAtdcxzMQNEE7PcuQrGu83No3l0lw/edit#slide=id.p) | 108 * [BlinkOn 6 presentation slides](https://docs.google.com/presentation/d/1gqK9F4
lGAY3TZudAtdcxzMQNEE7PcuQrGu83No3l0lw/edit#slide=id.p) |
103 * [Architecture design doc](https://docs.google.com/document/d/11zIkKkLBocofGgoT
eeyibB2TZ_k7nR78v7kNelCatUE) | 109 * [Architecture design doc](https://docs.google.com/document/d/11zIkKkLBocofGgoT
eeyibB2TZ_k7nR78v7kNelCatUE) |
OLD | NEW |