> 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/open.md).

# Open

The following example demonstrates how to request a browser instance, navigate to a webpage, and close the browser:

<pre class="language-javascript"><code class="lang-javascript">const rp = await browserService.open();
<strong>console.log('Browser opened');
</strong>
const browser = await puppeteer.connect({
  browserWSEndpoint: rp.address,
  defaultViewport: null,
  ignoreHTTPSErrors: true,
  slowMo: 0
});

const pages = await browser.pages();
const page = pages[0];
await page.goto('https://cloudbrowser.ai');
</code></pre>

***

#### F**ull example**

{% embed url="<https://github.com/CloudBrowser-AI/CloudBrowserAiNodeJS/blob/main/samples/open/index.js>" %}

This code initializes a Puppeteer browser instance using a remote service and navigates to a specific webpage. First, it opens a remote browser session via `browserService.open()` and logs that the browser has been opened. Then, it connects Puppeteer to the remote browser using the WebSocket endpoint from the session (`rp.address`) with specific options, such as disabling viewport restrictions and ignoring HTTPS errors. It retrieves all open pages within the browser, selects the first one, and navigates it to the URL `https://cloudbrowser.ai`.

## Open (with parameters)

The following example demonstrates how to request a browser instance with advanced configuration, including custom browser settings, proxy, and a timeout for keeping the browser open.

* **Label**: Set a custom label for the browser instance.
* **Browser**: Choose the browser type (e.g., Chromium or Chrome).
* **KeepOpen**: Set the timeout in seconds for how long the browser should remain open without a Puppeteer connection.
* **Proxy**: Configure proxy settings (host, port, username, password).

```javascript
const rp = await browserService.open({
    label: "MyCustomBrowser",
    //Chromium is supported but we recommend Chrome for best stealth
    browser: SupportedBrowser.CHROMIUM,
    keepOpen: 10 * 60, //This browser will close after 10 minutes without any Puppeteer connected.
    proxy: {
        host: "IP.0.0.0.1",
        port: "3000",
        password: "password",
        username: "username",
    },
});
```

***

#### F**ull example**

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