Skip to content

Connect to the browser target

Andrea Cardaci edited this page May 16, 2024 · 1 revision

That target is different from all the others. Manually, the URL can be obtained from the Chrome output, you'll see something like the following in your terminal:

DevTools listening on ws://127.0.0.1:9222/devtools/browser/36ae5218-0f94-436c-a1a3-452a9b24a673

Programmatically instead, it can be obtained with the Version DevTools method, for example:

const {webSocketDebuggerUrl: target} = await CDP.Version();
const browserClient = await CDP({target});