ENF News Bot
Automated News Bot
- Joined
- Apr 15, 2022
- Messages
- 2,591
Browser Run browser bindings now provide typed methods for session management and DevTools operations. You can acquire a session, connect a browser client, create Live View URLs, manage targets, and close sessions without constructing HTTP requests.
The new
Use
The binding also includes session methods for Live View, active sessions, session history, limits, session details, and cleanup. The nested
Refer to the Browser binding API documentation for method signatures and the outbound Worker feature guide for routing examples.
Continue reading...
The new
acquire() and launch() methods also accept outboundByHost. This lets you route requests for selected hostnames through another Worker, including a Worker that adds authentication or reaches a private service.
Code:
const connection = await env.BROWSER.launch({
outboundByHost: {
"private.example.test": env.OUTBOUND,
},
});
Code:
const connection = await env.BROWSER.launch({
outboundByHost: {
"private.example.test": env.OUTBOUND,
},
});
Use
connectSession(sessionId) when you need to acquire and connect in separate steps. The method returns a session-pinned webSocket Fetcher for a CDP client.The binding also includes session methods for Live View, active sessions, session history, limits, session details, and cleanup. The nested
devtools binding provides typed methods for browser version information, protocol descriptions, and target operations such as listing, creating, activating, and closing targets.Refer to the Browser binding API documentation for method signatures and the outbound Worker feature guide for routing examples.
Continue reading...