> For the complete documentation index, see [llms.txt](https://cloudbrowser.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cloudbrowser.gitbook.io/docs/libraries/node.js-client/get.md).

# Get

The following example demonstrates how to request a browser instance, navigate to a webpage, disconnect the browser, retrieve details about all active browsers, and close them.

```javascript
const svc = new BrowserService(cloudBrowserToken);

const rp = await svc.open();

if (rp.status !== ResponseStatus.SUCCESS || rp.address == null) {
    console.log(`Error requesting browser: ${rp.status}`);
    return;
}
console.log("Browser requested");

const browser = await puppeteer.connect({
    browserWSEndpoint: rp.address,
    defaultViewport: null,
    slowMo: 0,
});
console.log("Browser connected");

const page = (await browser.pages())[0];
await page.goto("http://www.cloudbrowser.ai");
console.log("Web visited");

browser.disconnect();
console.log("Browser disconnected");

const rpGet = await svc.get();

console.log("Label | Address | Started On | VNC Opened | VNC Pass");
for (const b of rpGet.browsers) {
    console.log(
        `${b.label} | ${b.address} | ${b.startedOn} | ${b.vncPass !== null} | ${b.vncPass}`
    );
    await svc.close(b.address);
}
```

***

#### F**ull example**

{% embed url="<https://github.com/CloudBrowser-AI/CloudBrowserAiNodeJS/blob/main/samples/get-close/src/index.ts>" %}

The `svc.get()` method is crucial for managing and monitoring active browser sessions. Here's why it's important:

1. **Session Retrieval:** It provides a list of all currently active browser sessions, enabling visibility into ongoing operations.
2. **Detailed Insights:** Each session includes metadata like:
   * **Label:** Identifies the session for organization.
   * **Address:** The WebSocket endpoint to reconnect if needed.
   * **Started On:** Tracks when the session was initiated.
   * **VNC Status and Password:** Indicates whether a remote desktop (VNC) is active and provides access credentials.
3. **Session Cleanup:** By iterating through the retrieved sessions, you can close inactive or unneeded sessions, freeing up resources and preventing unnecessary costs.

In this script, `svc.get()` ensures that no orphaned browser sessions remain by listing all active sessions and systematically closing them.
