Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ BROWSERBASE_PROJECT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

# Optional: Default URL to open on startup (defaults to https://www.google.com)
BROWSERBASE_DEFAULT_URL=https://www.google.com

# Optional: Verified Browser Mode / advanced stealth (defaults to true).
# Set to "false" to disable. Requires a plan that includes advanced stealth.
BROWSERBASE_VERIFIED=true

# Optional: Browserbase-managed residential proxies (defaults to true).
# Set to "false" to disable. Requires a plan that includes proxies.
BROWSERBASE_PROXIES=true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ xattr -cr /Applications/Desktop\ Browserbase.app
- **Window State Persistence** - Remembers size and position between sessions
- **Bookmarks Bar** - Visual bookmarks bar (toggleable with Ctrl+Shift+B)
- **Downloads Bar** - Download progress tracking
- **Stealth Mode** - Advanced stealth enabled by default for bot detection bypass
- **Stealth Mode** - Verified Browser Mode (advanced stealth) + residential proxies enabled by default for bot detection bypass (toggle via `BROWSERBASE_VERIFIED` / `BROWSERBASE_PROXIES`)

## Prerequisites

Expand Down
20 changes: 17 additions & 3 deletions src/main/browserbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,30 @@ export class BrowserbaseClient {
/**
* Creates a new Browserbase remote browser session.
*
* The session is created with stealth mode enabled by default. Optionally
* accepts viewport dimensions and device scale factor for Retina support.
* Sessions are created with Verified Browser Mode (advanced stealth) and
* Browserbase-managed residential proxies enabled by default, which helps
* pass Cloudflare and similar anti-bot challenges. Both can be disabled via
* the BROWSERBASE_VERIFIED / BROWSERBASE_PROXIES env vars (set to "false").
* Optionally accepts viewport dimensions and device scale factor for Retina.
*
* Note: `verified` and residential `proxies` require a Browserbase plan that
* includes them.
*
* @param config - Optional session configuration
* @returns Session information including connection URLs
* @throws Error if session creation fails (auth, permissions, rate limit, etc.)
*/
async createSession(config?: Partial<SessionConfig>): Promise<BrowserbaseSession> {
// Default ON. Set the env var to "false" to disable.
// `verified` => browserSettings.verified (Verified Browser Mode / advanced stealth).
// `proxies` => top-level proxies (Browserbase-managed residential proxies).
const verified = process.env.BROWSERBASE_VERIFIED !== "false";
const useProxies = process.env.BROWSERBASE_PROXIES !== "false";

const browserSettings: Record<string, unknown> = {
stealth: true,
verified,
};
console.log("Creating session with verified:", verified, "proxies:", useProxies);

// Add viewport if provided
if (config?.browserSettings?.viewport) {
Expand All @@ -147,6 +160,7 @@ export class BrowserbaseClient {
},
body: JSON.stringify({
projectId: this.projectId,
proxies: useProxies,
browserSettings,
}),
});
Expand Down
6 changes: 4 additions & 2 deletions src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ export interface ViewportConfig {
export interface SessionConfig {
/** Browserbase project ID (usually set via environment variable) */
projectId?: string;
/** Enable Browserbase-managed residential proxies (default: true) */
proxies?: boolean;
/** Browser-specific settings */
browserSettings?: {
/** Enable stealth mode for bot detection bypass (default: true) */
stealth?: boolean;
/** Enable Verified Browser Mode / advanced stealth for bot detection bypass (default: true) */
verified?: boolean;
/** Initial viewport dimensions */
viewport?: ViewportConfig;
/** Device scale factor for Retina displays (2 for macOS, 1 for others) */
Expand Down