Playwright, Puppeteer, Selenium
The approach is the same everywhere: launch the profile through the local API, get the CDP address, and connect to the already running browser. Geksy launches the browser, not your script; otherwise you get no fingerprint, no proxy, and no sync.
Scripts read the local API port and token from %LOCALAPPDATA%\Geksy\agent.json. Get the workspace and profile
IDs (WS, PROFILE) in the web app or through the cloud API.
Playwright and Puppeteer connect to the permanent profile address with a token (POST /api/v1/cdp-tokens): through
it, the app hides signs of a connected automation client from the page. Selenium connects to the direct address from
the start response, since ChromeDriver can’t send a token. More on the permanent address, recipes for Patchright,
browser MCP servers, browser-use, Stagehand, and the tested versions are in
Connect your browser code.
Playwright
Section titled “Playwright”import json, os, requestsfrom playwright.sync_api import sync_playwright
cfg = json.load(open(os.path.expandvars(r"%LOCALAPPDATA%\Geksy\agent.json")))API = f"http://127.0.0.1:{cfg['port']}/api/v1"H = {"Authorization": f"Bearer {cfg['token']}"}WS, PROFILE = "1b7e…", "8f0c…"
requests.post(f"{API}/profiles/{PROFILE}/start", json={"workspace_id": WS, "headless": False}, headers=H)T = requests.post(f"{API}/cdp-tokens", json={"workspace_id": WS, "profile_id": PROFILE}, headers=H).json()
with sync_playwright() as pw: browser = pw.chromium.connect_over_cdp(T["http_endpoint"], headers=T["headers"]) ctx = browser.contexts[0] page = ctx.pages[0] if ctx.pages else ctx.new_page() page.goto("https://example.com") print(page.title()) browser.close() # disconnect; the profile itself keeps running
requests.post(f"{API}/profiles/{PROFILE}/stop", json={"workspace_id": WS}, headers=H) # close; data goes to the cloudimport { readFileSync } from "node:fs";import { chromium } from "playwright";
const cfg = JSON.parse(readFileSync(`${process.env.LOCALAPPDATA}\\Geksy\\agent.json`, "utf8"));const API = `http://127.0.0.1:${cfg.port}/api/v1`;const H = { Authorization: `Bearer ${cfg.token}`, "Content-Type": "application/json" };const WS = "1b7e…", PROFILE = "8f0c…";
await fetch(`${API}/profiles/${PROFILE}/start`, { method: "POST", headers: H, body: JSON.stringify({ workspace_id: WS, headless: false }),});const T = await (await fetch(`${API}/cdp-tokens`, { method: "POST", headers: H, body: JSON.stringify({ workspace_id: WS, profile_id: PROFILE }),})).json();
const browser = await chromium.connectOverCDP(T.http_endpoint, { headers: T.headers });const ctx = browser.contexts()[0];const page = ctx.pages()[0] ?? (await ctx.newPage());await page.goto("https://example.com");console.log(await page.title());await browser.close(); // disconnect; the profile itself keeps running
await fetch(`${API}/profiles/${PROFILE}/stop`, { method: "POST", headers: H, body: JSON.stringify({ workspace_id: WS }) });With the Python SDK, it’s shorter: Agent().start(WS, PROFILE) launches the profile, and
Agent().cdp_token(WS, PROFILE) returns the permanent address and headers.
Puppeteer
Section titled “Puppeteer”import { readFileSync } from "node:fs";import puppeteer from "puppeteer-core";
const cfg = JSON.parse(readFileSync(`${process.env.LOCALAPPDATA}\\Geksy\\agent.json`, "utf8"));const API = `http://127.0.0.1:${cfg.port}/api/v1`;const H = { Authorization: `Bearer ${cfg.token}`, "Content-Type": "application/json" };const WS = "1b7e…", PROFILE = "8f0c…";
await fetch(`${API}/profiles/${PROFILE}/start`, { method: "POST", headers: H, body: JSON.stringify({ workspace_id: WS, headless: false }),});const T = await (await fetch(`${API}/cdp-tokens`, { method: "POST", headers: H, body: JSON.stringify({ workspace_id: WS, profile_id: PROFILE }),})).json();
const browser = await puppeteer.connect({ browserWSEndpoint: T.ws_endpoint, headers: T.headers, defaultViewport: null });const [page] = await browser.pages();await page.goto("https://example.com");console.log(await page.title());await browser.disconnect();Install puppeteer-core, not puppeteer: the browser is already there, so you don’t need to download another
Chromium. defaultViewport: null keeps the real window size, so it matches the fingerprint.
Selenium
Section titled “Selenium”Selenium connects to the browser at the host:port debugging address, which is cdp_http without http://.
import json, os, requestsfrom selenium import webdriver
cfg = json.load(open(os.path.expandvars(r"%LOCALAPPDATA%\Geksy\agent.json")))API = f"http://127.0.0.1:{cfg['port']}/api/v1"H = {"Authorization": f"Bearer {cfg['token']}"}WS, PROFILE = "1b7e…", "8f0c…"p = requests.post(f"{API}/profiles/{PROFILE}/start", json={"workspace_id": WS, "headless": False}, headers=H).json()
opts = webdriver.ChromeOptions()opts.debugger_address = p["cdp_http"].removeprefix("http://") # "127.0.0.1:53412"driver = webdriver.Chrome(options=opts)driver.get("https://example.com")print(driver.title)driver.service.stop() # disconnect the driver; driver.quit() would close the browser windowsimport { readFileSync } from "node:fs";import { Builder } from "selenium-webdriver";import chrome from "selenium-webdriver/chrome.js";
const cfg = JSON.parse(readFileSync(`${process.env.LOCALAPPDATA}\\Geksy\\agent.json`, "utf8"));const API = `http://127.0.0.1:${cfg.port}/api/v1`;const H = { Authorization: `Bearer ${cfg.token}`, "Content-Type": "application/json" };const WS = "1b7e…", PROFILE = "8f0c…";const p = await (await fetch(`${API}/profiles/${PROFILE}/start`, { method: "POST", headers: H, body: JSON.stringify({ workspace_id: WS, headless: false }),})).json();
const opts = new chrome.Options();opts.debuggerAddress(p.cdp_http.replace("http://", ""));const driver = await new Builder().forBrowser("chrome").setChromeOptions(opts).build();await driver.get("https://example.com");console.log(await driver.getTitle());What works differently
Section titled “What works differently”The Geksy engine doesn’t turn on the debugging mode in pages that sites use to spot automation. Because of that:
- Page console events (
page.on("console")in Playwright and Puppeteer) don’t arrive. Read the page messages yourself: captureconsolewith a script and collect what has piled up, for examplepage.add_init_script("window.__log=[];['log','warn','error'].forEach(k=>{const f=console[k];console[k]=(...a)=>{window.__log.push([k,...a].join(' '));f(...a)}})")and thenpage.evaluate("window.__log.splice(0)"). Or use the local APIevalaction (an isolated world: page variables aren’t visible to it). exposeBindingandexposeFunctionin Playwright don’t work: the page can’t call a function of your script. Instead, poll: the page puts data into a variable or the DOM, and the script reads it withevaluateon a timer; or use local API actions (wait_for,extract). PuppeteerexposeFunctionand PatchrightexposeBindingwork.- Downloads over CDP are saved on the computer where the browser runs: the script gets the event and the file name, and the file lands in the profile’s downloads folder on that computer.
- Selenium connects to the direct debugging address (
cdp_http); ChromeDriver can’t connect through the permanent token address because it can’t send the token. Use the ChromeDriver with the same major version as the engine.
Tested versions are in Connect your browser code.
Several profiles in parallel
Section titled “Several profiles in parallel”Each profile is a separate browser process with its own CDP addresses. Launch them one by one through the local API and connect to each in its own thread or task. How many profiles your PC can handle depends mostly on memory.
- Don’t override the User-Agent, time zone, language, or window size with Playwright or Puppeteer: the fingerprint already handles this, and manual overrides create mismatches.
- Use
"headless": truefor background tasks. - Close the profile with a
stopcall; that way the data is guaranteed to reach the cloud.