Skip to content

Commit 26bdfda

Browse files
committed
Address review feedback on Live View and HITL docs
- Remove Full viewing mode row (not yet tested) - Change Inspector URL to mode=devtools - Remove "Get the Live View URL programmatically" section (not yet shipped) - Condense Native Chrome DevTools pros/cons into single paragraph - Replace Cloudflare.getLiveView with includeTargets=true in HITL example - Add timeout and Slack/chat notes to HITL code comments - Add bot detection note to HITL page
1 parent 403a809 commit 26bdfda

2 files changed

Lines changed: 14 additions & 50 deletions

File tree

src/content/docs/browser-rendering/features/human-in-the-loop.mdx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Some browser automation workflows require manual intervention. A login page may
1414
Human in the Loop works with any [Browser Session](/browser-rendering/#integration-methods) and uses [Live View](/browser-rendering/features/live-view/) to give humans access:
1515

1616
1. Your automation script navigates to a page that needs human input.
17-
2. The script retrieves the Live View URL via `Cloudflare.getLiveView` and shares it with a human operator (for example, by logging it, sending it via Slack, or displaying it in a UI).
17+
2. The script retrieves the [Live View](/browser-rendering/features/live-view/) URL from the session's target list and shares it with a human operator (for example, by sending it via Slack, email, or displaying it in a UI).
1818
3. The human operator opens the Live View URL and completes the required action (logging in, solving a CAPTCHA, entering sensitive data, etc.).
1919
4. The automation script detects that the human is done (for example, by waiting for a navigation event or polling for a page element) and resumes.
2020

@@ -32,13 +32,14 @@ const API_TOKEN = "your-api-token";
3232

3333
// Create a browser session via CDP
3434
const response = await fetch(
35-
`https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/browser-rendering/devtools/browser?keep_alive=600000`,
35+
`https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/browser-rendering/devtools/browser?keep_alive=600000&includeTargets=true`,
3636
{
3737
method: "POST",
3838
headers: { Authorization: `Bearer ${API_TOKEN}` },
3939
}
4040
);
41-
const { webSocketDebuggerUrl } = await response.json();
41+
const { webSocketDebuggerUrl, targets } = await response.json();
42+
const liveUrl = targets[0].devtoolsFrontendUrl;
4243

4344
// Connect Puppeteer to the session
4445
const browser = await puppeteer.connect({
@@ -49,16 +50,10 @@ const browser = await puppeteer.connect({
4950
const page = await browser.newPage();
5051
await page.goto("https://example.com/login");
5152

52-
// Get the Live View URL so a human can interact with the session
53-
const cdp = await page.createCDPSession();
54-
const { devtoolsFrontendUrl: liveUrl } = await cdp.send(
55-
"Cloudflare.getLiveView"
56-
);
57-
58-
// Share the Live View URL with the human operator
53+
// Share the Live View URL with the human operator (for example, send it via Slack, email, or display it in a UI)
5954
console.log(`Human input needed. Open this URL: ${liveUrl}`);
6055

61-
// Wait for the human to complete login
56+
// Wait for the human to complete login (5 minute timeout — the script will continue after this period)
6257
await page.waitForNavigation({ waitUntil: "networkidle0", timeout: 300000 });
6358

6459
// Login complete, continue automation
@@ -77,3 +72,7 @@ browser.disconnect();
7772
- **Sensitive data entry**: Forms requiring credentials or personal information you do not want to pass to an automation script
7873
- **Complex interactions**: One-off tasks that are too difficult or not worth fully automating, such as configuring a dashboard or approving a workflow
7974
- **Verification steps**: Confirming an order, reviewing generated content, or approving an action before the script proceeds
75+
76+
:::note[Bot detection]
77+
Browser Rendering requests are [always identified as bot traffic](/browser-rendering/faq/#will-browser-rendering-be-detected-by-bot-management). Even with a human controlling the session, some third-party services may still block the request.
78+
:::

src/content/docs/browser-rendering/features/live-view.mdx

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar:
77
badge: Beta
88
---
99

10-
import { CURL, DashButton, Tabs, TabItem } from "~/components";
10+
import { CURL, DashButton } from "~/components";
1111

1212
Live View lets you see and interact with a remote Browser Run session in real time. This is useful for debugging automation scripts, monitoring what a browser is doing, or manually stepping in when a task requires human intervention (see [Human in the Loop](/browser-rendering/features/human-in-the-loop/)).
1313

@@ -27,13 +27,12 @@ In the Cloudflare dashboard, go to the **Browser Run** page and select the **Liv
2727

2828
When you create a session or list targets through the [CDP](/browser-rendering/cdp/) endpoints, the API response includes a `devtoolsFrontendUrl` for each target (tab). Open this URL in any browser to load the DevTools UI hosted at `live.browser.run`, which streams the remote session to your browser.
2929

30-
The hosted UI supports three viewing modes, controlled by the `mode` parameter in the URL:
30+
The hosted UI supports two viewing modes, controlled by the `mode` parameter in the URL:
3131

3232
| Mode | URL pattern | Description |
3333
| --- | --- | --- |
3434
| Tab | `https://live.browser.run/ui/view?mode=tab&wss=...` | DevTools inspector panel (Elements, Console, Network, etc.) |
35-
| Full | `https://live.browser.run/ui/view?mode=full&wss=...` | Full browser chrome with address bar and tab strip |
36-
| Inspector | `https://live.browser.run/ui/inspector?wss=...` | Standalone inspector view |
35+
| Inspector | `https://live.browser.run/ui/view?mode=devtools&wss=...` | Standalone inspector view |
3736

3837
### Native Chrome DevTools (Chrome only)
3938

@@ -43,15 +42,7 @@ Because Browser Run speaks standard CDP, you can connect Chrome's built-in DevTo
4342
devtools://devtools/bundled/inspector.html?wss=live.browser.run/api/devtools/browser/SESSION_ID/page/TARGET_ID?jwt=...
4443
```
4544

46-
Paste this URL into Chrome's address bar to open native DevTools connected to the remote browser session.
47-
48-
**Pros:**
49-
- Familiar UI: the exact same DevTools you use daily for local development, rather than a hosted version wrapped inside a webpage
50-
- Slightly faster to load: DevTools assets (HTML, JS, CSS) are already bundled locally in Chrome
51-
52-
**Cons:**
53-
- Chrome only: the `devtools://` protocol URL only works in Chrome. The hosted `live.browser.run` version works in other browsers, though the DevTools UI has not been heavily tested outside Chrome.
54-
- Inspector tab only: does not work for the full or tab viewing modes
45+
Paste this URL into Chrome's address bar to open native DevTools connected to the remote browser session. This gives you the familiar local DevTools UI and loads slightly faster since the assets are already bundled in Chrome. However, the `devtools://` protocol only works in Chrome and only supports the inspector viewing mode.
5546

5647
:::caution[URL validity]
5748
The `devtoolsFrontendUrl` is valid for five minutes from when it was generated. If you do not open the URL within this timeframe, list the targets again to get a fresh URL. Once the DevTools connection is established, it remains active as long as the browser session is alive.
@@ -132,29 +123,3 @@ If you have a running session and want to connect to it:
132123
```
133124

134125
3. Copy the `devtoolsFrontendUrl` and open it in your browser.
135-
136-
## Get the Live View URL programmatically
137-
138-
You can retrieve the Live View URL from within a Puppeteer or Playwright script using a CDP command. This is useful when you need to share the URL with someone, for example sending it via email, Slack, or displaying it in a UI.
139-
140-
<Tabs> <TabItem label="Puppeteer">
141-
142-
```js
143-
const cdp = await page.createCDPSession();
144-
const { devtoolsFrontendUrl } = await cdp.send("Cloudflare.getLiveView");
145-
146-
console.log(`Live View: ${devtoolsFrontendUrl}`);
147-
```
148-
149-
</TabItem> <TabItem label="Playwright">
150-
151-
```js
152-
const cdp = await page.context().newCDPSession(page);
153-
const { devtoolsFrontendUrl } = await cdp.send("Cloudflare.getLiveView");
154-
155-
console.log(`Live View: ${devtoolsFrontendUrl}`);
156-
```
157-
158-
</TabItem> </Tabs>
159-
160-
You can also get the Live View URL from the HTTP API by listing targets for a session, as shown in [View an existing session](#view-an-existing-session). Each target in the response includes a `devtoolsFrontendUrl`.

0 commit comments

Comments
 (0)