Mention precompiled chrome-headless-shell
binaries
Drive-by: various minor edits and corrections. Bug: chromium:1428879 Change-Id: I9c9fbb878439305c16fb9560bd14c5155c8ebd51 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4774637 Auto-Submit: Mathias Bynens <mathias@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org> Reviewed-by: Peter Kvitek <kvitekp@chromium.org> Cr-Commit-Position: refs/heads/main@{#1184542}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e025224c51
commit
31eceb2e37
@ -9,17 +9,13 @@ There are two ways to use Headless Chromium:
|
||||
|
||||
## Usage via the DevTools remote debugging protocol
|
||||
|
||||
1. Start a normal Chrome binary with the `--headless` command line flag
|
||||
(Linux-only for now):
|
||||
1. Start a normal Chrome binary with the `--headless` command line flag:
|
||||
|
||||
```
|
||||
$ chrome --headless --remote-debugging-port=9222 https://chromium.org
|
||||
```sh
|
||||
$ chrome --headless --remote-debugging-port=9222 https://chromium.org/
|
||||
```
|
||||
|
||||
Currently you'll also need to use `--disable-gpu` to avoid an error from a
|
||||
missing Mesa library.
|
||||
|
||||
2. Navigate to `http://localhost:9222` in another browser to open the
|
||||
2. Navigate to `http://localhost:9222/` in another browser to open the
|
||||
[DevTools](https://developer.chrome.com/devtools) interface or use a tool such
|
||||
as [Selenium](http://www.seleniumhq.org/) to drive the headless browser.
|
||||
|
||||
@ -28,7 +24,7 @@ as [Selenium](http://www.seleniumhq.org/) to drive the headless browser.
|
||||
For example, the [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface)
|
||||
Node.js package can be used to extract a page's DOM like this:
|
||||
|
||||
```
|
||||
```js
|
||||
const CDP = require('chrome-remote-interface');
|
||||
|
||||
CDP((client) => {
|
||||
@ -66,7 +62,7 @@ is a small sample application which demonstrates the use of the headless C++
|
||||
API. It loads a web page and outputs the resulting DOM. To run it, first
|
||||
initialize a headless build configuration:
|
||||
|
||||
```
|
||||
```sh
|
||||
$ mkdir -p out/Debug
|
||||
$ echo 'import("//build/args/headless.gn")' > out/Debug/args.gn
|
||||
$ gn gen out/Debug
|
||||
@ -74,14 +70,14 @@ $ gn gen out/Debug
|
||||
|
||||
Then build the example:
|
||||
|
||||
```
|
||||
```sh
|
||||
$ ninja -C out/Debug headless_example
|
||||
```
|
||||
|
||||
After the build completes, the example can be run with the following command:
|
||||
|
||||
```
|
||||
$ out/Debug/headless_example https://www.google.com
|
||||
```sh
|
||||
$ out/Debug/headless_example https://www.google.com/
|
||||
```
|
||||
|
||||
[Headless Shell](https://cs.chromium.org/chromium/src/headless/app/headless_shell.cc)
|
||||
@ -90,12 +86,16 @@ debugging with the [DevTools](https://developer.chrome.com/devtools) protocol.
|
||||
To do this, start the application with an argument specifying the debugging
|
||||
port:
|
||||
|
||||
```
|
||||
```sh
|
||||
$ ninja -C out/Debug headless_shell
|
||||
$ out/Debug/headless_shell --remote-debugging-port=9222 https://youtube.com
|
||||
$ out/Debug/headless_shell --remote-debugging-port=9222 https://youtube.com/
|
||||
```
|
||||
|
||||
Then navigate to `http://localhost:9222` with your browser.
|
||||
Then navigate to `http://localhost:9222/` with your browser.
|
||||
|
||||
As of M118, precompiled `headless_shell` binaries are available for download
|
||||
under the name `chrome-headless-shell` via [Chrome for Testing
|
||||
infrastructure](https://googlechromelabs.github.io/chrome-for-testing/).
|
||||
|
||||
## Embedder API
|
||||
|
||||
|
Reference in New Issue
Block a user