--- title: "Connect to a Headless Browser" url: https://docs.catalyst.zoho.com/en/smartbrowz/help/browser-grid/headless-connect/ description: "Process massive load of requests using multiple headless browsers connected using automation libraries, with greater control over node and browser configurations" last_updated: 2026-10-06T06:21:49Z service: SmartBrowz type: general related_links: - name: "Browser Grid Features" url: /en/smartbrowz/help/browser-grid/features/ - name: "Browser Grid Workflow" url: /en/smartbrowz/help/browser-grid/workflow/ - name: "Create a Browser Grid" url: /en/smartbrowz/help/browser-grid/create-grid/ - name: "Browser Grid Java SDK" url: /en/sdk/java/v1/smartbrowz/browser-grid/overview/ - name: "Browser Grid Node.js SDK" url: /en/sdk/nodejs/v2/smartbrowz/browser-grid/overview/ - name: "Browser Grid Python SDK" url: /en/sdk/python/v1/smartbrowz/browser-grid/overview/ - name: "Browser Grid REST API" url: /en/api/code-reference/smartbrowz/browser-grid/list-all-grids/#ListallBrowserGrids --- # Connect to Headless Chrome or Firefox > 📢 **Announcement:** Browser Grid is now available in all DCs. Use it for free until **November 1, 2026**. Catalyst SmartBrowz will generate a CDP/Webdriver endpoint once you create a Browser Grid. This endpoint will be made secure using an unique API key, which will also be generated by the SmartBrowz service. You need to use this secure endpoint in your code to connect to the remote browser and activate the grid. ![catalyst_smartbrowz_browsergrid_access_url](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/browser-grid/catalyst_smartbrowz_browsergrid_access_url.webp) The SmartBrowz console also provides you with the required code snippets in [Java](https://docs.catalyst.zoho.com/en/sdk/java/v1/smartbrowz/browser-grid/overview/), [Node.js](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/smartbrowz/browser-grid/overview/) and [Python](https://docs.catalyst.zoho.com/en/sdk/python/v1/smartbrowz/browser-grid/overview/) function stack. To access the required code snippet: 1. Click **How to Connect?** ![catalyst_smartbrowz_browsergrid_connect_strt](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/browser-grid/catalyst_smartbrowz_browsergrid_connect_strt.webp) 2. You will be able to view and copy the code snippet that you need to use to connect to the headless browsers. You can use the drop-down to select your required runtime. ![catalyst_smartbrowz_browsergrid_stack_sel_connect](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/browser-grid/catalyst_smartbrowz_browsergrid_stack_sel_connect.webp) 3. You need to paste the snippet to your code file and execute it to trigger the browser grid and connect to your headless browsers. ![catalyst_smartbrowz_browsergrid_active_label](https://catalyst-docs-development.zohostratus.in/images/help/smartbrowz/browser-grid/catalyst_smartbrowz_browsergrid_active_label.webp) Once connected, the grid will be marked **Active**. Based on your configuration, the nodes will spawn the required number of browsers to process your requests. > **Info:** Ensure that you click the **Refresh** button to render the latest stats. ### Code Snippets to Connect to the Headless Browser The following are code snippets that you need to copy and use in your code to activate your browser grid and connect to the headless browser. **Selenium** **Java** **Connect to Headless Chrome** ```java import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.Capabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.chrome.ChromeOptions; public class RemoteChromeLoggingExample { public static void main(String[] args) throws MalformedURLException { ChromeOptions options = new ChromeOptions(); options.addArguments("--no-sandbox"); options.addArguments("--headless"); URL remoteUrl = new URL("YOUR_WEBDRIVER_ENDPOINT"); RemoteWebDriver driver = new RemoteWebDriver(remoteUrl, options); Capabilities caps = driver.getCapabilities(); String browserName = caps.getBrowserName(); String browserVersion = caps.getBrowserVersion(); System.out.println("Browser: " + browserName + " " + browserVersion); driver.get("https://example.com"); System.out.println("Page title is: " + driver.getTitle()); driver.quit(); } } ``` **Connect to Headless Firefox** ```java import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.Capabilities; import org.openqa.selenium.firefox.FirefoxOptions; import org.openqa.selenium.remote.RemoteWebDriver; public class RemoteFirefoxLoggingExample { public static void main(String[] args) throws MalformedURLException { FirefoxOptions options = new FirefoxOptions(); options.addArguments("--headless"); options.addArguments("--no-sandbox"); options.addArguments("--disable-dev-shm-usage"); URL remoteUrl = new URL("YOUR_WEBDRIVER_ENDPOINT"); RemoteWebDriver driver = new RemoteWebDriver(remoteUrl, options); Capabilities caps = driver.getCapabilities(); String browserName = caps.getBrowserName(); String browserVersion = caps.getBrowserVersion(); System.out.println("Browser: " + browserName + " " + browserVersion); driver.get("https://example.com"); System.out.println("Page title is: " + driver.getTitle()); driver.quit(); } } ``` **Node.js** **Connect to Headless Chrome** ```js const { Builder } = require('selenium-webdriver'); const chrome = require('selenium-webdriver/chrome'); (async function test() { let options = new chrome.Options(); options.addArguments('--headless'); options.addArguments('--no-sandbox'); let driver = await new Builder() .forBrowser('chrome') .setChromeOptions(options) .usingServer('YOUR_WEBDRIVER_ENDPOINT') .build(); try { await driver.get('https://example.com'); console.log(await driver.getTitle()); } catch (err) { console.error(err); } finally { await driver.quit(); } })(); ``` **Connect to Headless Firefox** ```js const { Builder, By } = require('selenium-webdriver'); const firefox = require('selenium-webdriver/firefox'); (async function RemoteFirefoxLoggingExample() { let options = new firefox.Options(); options.addArguments('--headless'); let driver = await new Builder() .forBrowser('firefox') .setFirefoxOptions(options) .usingServer('YOUR_WEBDRIVER_ENDPOINT') .build(); try { await driver.get('https://example.com'); console.log(await driver.getTitle()); } catch (err) { console.error(err); } finally { await driver.quit(); } })(); ``` **Python** **Connect to Headless Chrome** ```python import asyncio from selenium import webdriver from selenium.webdriver.chrome.options import Options async def index(): options = Options() options.add_argument("--disable-extensions") options.add_argument("--no-sandbox") options.add_argument("--headless") options.add_argument("--disable-dev-shm-usage") driver = webdriver.Remote( command_executor="YOUR_WEBDRIVER_ENDPOINT", options=options ) driver.get("https://example.com") driver.save_screenshot("screenshot.png") driver.quit() async def my_async_function(): await index() if __name__ == "__main__": asyncio.run(my_async_function()) ``` **Connect to Headless Firefox** ```python import asyncio from selenium import webdriver from selenium.webdriver.firefox.options import Options async def index(): options = Options() options.add_argument("--headless") capabilities = { "browserName": "firefox", "browserVersion": "latest", "platformName": "linux" } driver = webdriver.Remote( command_executor="YOUR_WEBDRIVER_ENDPOINT", desired_capabilities=capabilities, options=options ) driver.get("https://example.com") driver.save_screenshot("screenshot.png") driver.quit() async def my_async_function(): await index() if __name__ == "__main__": asyncio.run(my_async_function()) ``` **Puppeteer** **Node.js** **Connect to Headless Chrome** ```js const puppeteer = require("puppeteer"); (async () => { const browser = await puppeteer.connect({ browserWSEndpoint: "YOUR_ENDPOINT" }); const page = await browser.newPage(); await page.goto("https://example.com"); await page.screenshot({ path: "remote-example.png" }); await browser.disconnect(); })(); ``` **Python** **Connect to Headless Chrome** ```python import asyncio from pyppeteer import connect async def main(): browser = await connect({ 'browserWSEndpoint': 'YOUR_ENDPOINT' }) page = await browser.newPage() await page.goto("https://example.com") await page.screenshot({'path': 'screenshot.png'}) await browser.close() asyncio.run(main()) ``` **Playwright** **Java** **Connect to Headless Chrome** ```java package com.example; import java.nio.file.Paths; import com.microsoft.playwright.*; public class Test { public static void main(String[] args) { try (Playwright playwright = Playwright.create()) { BrowserType browserType = playwright.chromium(); Browser browser = browserType.connectOverCDP("YOUR_ENDPOINT"); Page page = browser.newPage(); page.navigate("https://example.com"); System.out.println("Title: " + page.title()); page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("screenshot.png"))); String html = page.content(); System.out.println("Page HTML: " + html.substring(0, Math.min(html.length(), 200)) + "..."); browser.close(); } } } ``` **Node.js** **Connect to Headless Chrome** ```js const { chromium } = require("playwright"); (async () => { const browser = await chromium.connectOverCDP("YOUR_ENDPOINT"); const context = browser.contexts().length ? browser.contexts()[0] : await browser.newContext(); const page = await context.newPage(); await page.goto("https://example.com"); console.log(await page.title()); await browser.close(); })(); ``` **Python** **Connect to Headless Chrome** ```python import asyncio from playwright.async_api import async_playwright async def run(playwright): browser = await playwright.chromium.connect_over_cdp("YOUR_ENDPOINT") context = await browser.new_context() page = await context.new_page() await page.goto("https://example.com") await page.screenshot(path="screenshot.png") print(await page.title()) await browser.close() async def main(): async with async_playwright() as playwright: await run(playwright) asyncio.run(main()) ``` > **Notice:** Any Browser action or operation that you code using the Browser Logic function, or any browser automation or web scraping task that you perform using any component of Catalyst SmartBrowz is at your own risk. We strongly recommend you use the SmartBrowz components to perform operations on domains that permit such actions, or with proper approval.Additionally, while Catalyst does provide a secure infrastructure to code your functions, any consequence of the logic you code using Catalyst functions is yours alone.