diff --git a/README.md b/README.md index 593d93f3..3706a773 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Ready-to-use automation templates for Stagehand and Browserbase. Each template h | amazon-global-price-comparison | [TS](typescript/amazon-global-price-comparison) | [PY](python/amazon-global-price-comparison) | - | Compare Amazon product prices across multiple countries using geolocation proxies | | amazon-product-scraping | [TS](typescript/amazon-product-scraping) | [PY](python/amazon-product-scraping) | - | Scrape the first 3 Amazon search results for a given query and return structured product data | | basic-caching | [TS](typescript/basic-caching) | [PY](python/basic-caching) | - | Demonstrate how Stagehand's caching feature reduces cost and latency by reusing previously computed actions | -| basic-recaptcha | [TS](typescript/basic-recaptcha) | [PY](python/basic-recaptcha) | - | Automatic reCAPTCHA solving using Browserbase's built-in captcha solving capabilities | +| basic-captcha-solving | [TS](typescript/basic-captcha-solving) | [PY](python/basic-captcha-solving) | - | Automatic CAPTCHA solving using Browserbase's built-in captcha solving capabilities | | browser-agent-demo | [TS](typescript/browser-agent-demo) | - | - | Browser agent that searches the web, fetches page content, and autonomously extracts information | | browserbase-reducto | [TS](typescript/browserbase-reducto) | [PY](python/browserbase-reducto) | - | Download financial PDFs from websites and extract structured data using AI-powered document parsing | | business-lookup | [TS](typescript/business-lookup) | [PY](python/business-lookup) | - | Research business registry records with a bring-your-own agent and Stagehand code mode | diff --git a/python/basic-recaptcha/.env.example b/python/basic-captcha-solving/.env.example similarity index 100% rename from python/basic-recaptcha/.env.example rename to python/basic-captcha-solving/.env.example diff --git a/python/basic-recaptcha/README.md b/python/basic-captcha-solving/README.md similarity index 87% rename from python/basic-recaptcha/README.md rename to python/basic-captcha-solving/README.md index dbb62409..00f5c772 100644 --- a/python/basic-recaptcha/README.md +++ b/python/basic-captcha-solving/README.md @@ -1,10 +1,10 @@ -# Stagehand + Browserbase: Basic reCAPTCHA Solving +# Stagehand + Browserbase: Basic CAPTCHA Solving Stagehand is the SDK for browser agents. ## AT A GLANCE -- Goal: Demonstrate automatic reCAPTCHA solving using Browserbase's built-in captcha solving capabilities. +- Goal: Demonstrate automatic CAPTCHA solving using Browserbase's built-in captcha solving capabilities. - Automated Solving: Browserbase automatically detects and solves CAPTCHAs in the background. CAPTCHA solving is **enabled by default** - you don't need to set `solveCaptchas: true` unless you want to explicitly enable it (or set it to `false` to disable). - Solving Time: CAPTCHA solving typically takes between 5-30 seconds depending on CAPTCHA type and complexity. - Progress Monitoring: Listen for console messages (`browserbase-solving-started`, `browserbase-solving-finished`) to track captcha solving progress in real-time. @@ -14,7 +14,7 @@ Stagehand is the SDK for browser agents. ## GLOSSARY -- solveCaptchas: Browserbase browser setting that enables automatic captcha solving for reCAPTCHA, hCaptcha, and other captcha types. Enabled by default for Basic and Advanced Stealth Mode. +- solveCaptchas: Browserbase browser setting that enables automatic CAPTCHA solving. Enabled by default for Basic and Advanced Stealth Mode. Docs → https://docs.browserbase.com/features/stealth-mode#captcha-solving - CAPTCHA solving: When a CAPTCHA is detected, Browserbase attempts to solve it automatically in the background, allowing your automation to continue without manual intervention. - console messages: browser console events that indicate captcha solving status: @@ -36,7 +36,7 @@ Browserbase provides integrated CAPTCHA solving to handle challenges automatical - **Solving Time**: CAPTCHA solving typically takes between 5-30 seconds, depending on the CAPTCHA type and complexity - **Default Behavior**: CAPTCHA solving is enabled by default for Basic and Advanced Stealth Mode - **Proxies**: It's recommended to enable proxies when using CAPTCHA solving for higher success rates -- **Multiple Types**: Browserbase supports reCAPTCHA, hCaptcha, and other common captcha providers automatically +- **Multiple Types**: Browserbase supports common CAPTCHA types automatically ### Custom CAPTCHA Solving @@ -78,10 +78,10 @@ browserbase_session_create_params = {"browser_settings": {"solveCaptchas": False - Initializes Stagehand session with Browserbase - Displays live session link for monitoring -- Navigates to Google reCAPTCHA demo page -- Waits for Browserbase to automatically solve the captcha -- Logs captcha solving progress messages -- Clicks submit button after captcha is solved +- Navigates to CAPTCHA demo page +- Waits for Browserbase to automatically solve the CAPTCHA +- Logs CAPTCHA solving progress messages +- Clicks submit button after CAPTCHA is solved - Extracts and displays page content - Prints the resulting page content for inspection - Closes session cleanly @@ -92,8 +92,8 @@ browserbase_session_create_params = {"browser_settings": {"solveCaptchas": False - Captcha solving not enabled: ensure `solveCaptchas: True` is set in browserSettings (enabled by default) - Solving timeout: allow up to 30 seconds for CAPTCHA solving to complete before timing out - Proxies not enabled: enable proxies in browserSettings for higher CAPTCHA solving success rates -- Demo page inaccessible: verify the reCAPTCHA demo page URL is accessible and hasn't changed -- Console message timing: ensure console event listeners are set up before triggering the captcha +- Demo page inaccessible: verify the CAPTCHA demo page URL is accessible and hasn't changed +- Console message timing: ensure console event listeners are set up before triggering the CAPTCHA - Custom captcha selectors: for non-standard CAPTCHAs, verify that `captchaImageSelector` and `captchaInputSelector` are correctly defined - Import errors: activate your virtual environment if you created one - ModuleNotFoundError: ensure all dependencies are installed via uvx install diff --git a/python/basic-recaptcha/main.py b/python/basic-captcha-solving/main.py similarity index 93% rename from python/basic-recaptcha/main.py rename to python/basic-captcha-solving/main.py index 73128f83..3a9c16c7 100644 --- a/python/basic-recaptcha/main.py +++ b/python/basic-captcha-solving/main.py @@ -1,4 +1,4 @@ -"""Solve and verify Google's reCAPTCHA demo with Stagehand V4.""" +"""Solve and verify CAPTCHA challenge with Stagehand V4.""" import asyncio import os @@ -58,6 +58,6 @@ async def main() -> None: try: asyncio.run(main()) except Exception as error: - print(f"reCAPTCHA example failed: {error}") + print(f"CAPTCHA solving example failed: {error}") print("Docs: https://docs.stagehand.dev/v4/first-steps/introduction") raise diff --git a/python/basic-recaptcha/pyproject.toml b/python/basic-captcha-solving/pyproject.toml similarity index 82% rename from python/basic-recaptcha/pyproject.toml rename to python/basic-captcha-solving/pyproject.toml index d9daf3e6..4bf4aec7 100644 --- a/python/basic-recaptcha/pyproject.toml +++ b/python/basic-captcha-solving/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "basic-recaptcha" +name = "basic-captcha-solving" version = "0.1.0" requires-python = ">=3.11,<3.14" dependencies = ["python-dotenv==1.2.2", "stagehand==4.0.0"] diff --git a/python/playwright/basic-recaptcha/.env.example b/python/playwright/basic-captcha-solving/.env.example similarity index 100% rename from python/playwright/basic-recaptcha/.env.example rename to python/playwright/basic-captcha-solving/.env.example diff --git a/python/playwright/basic-recaptcha/README.md b/python/playwright/basic-captcha-solving/README.md similarity index 88% rename from python/playwright/basic-recaptcha/README.md rename to python/playwright/basic-captcha-solving/README.md index 3caf637c..11b33900 100644 --- a/python/playwright/basic-recaptcha/README.md +++ b/python/playwright/basic-captcha-solving/README.md @@ -1,8 +1,8 @@ -# Playwright + Browserbase: Basic reCAPTCHA Solving (Python) +# Playwright + Browserbase: Basic CAPTCHA Solving (Python) ## AT A GLANCE -- Goal: Demonstrate automatic reCAPTCHA solving using Playwright with Browserbase's built-in captcha solving capabilities. +- Goal: Demonstrate automatic CAPTCHA solving using Playwright with Browserbase's built-in captcha solving capabilities. - Automated Solving: Browserbase automatically detects and solves CAPTCHAs in the background. CAPTCHA solving is **enabled by default** - you don't need to set `solveCaptchas: True` unless you want to explicitly enable it (or set it to `False` to disable). - Timeout Handling: Includes 60-second timeout to prevent indefinite waits on captcha solving failures. - Progress Monitoring: Listen for console messages (`browserbase-solving-started`, `browserbase-solving-finished`) to track captcha solving progress in real-time. @@ -12,7 +12,7 @@ - Browserbase SDK: Python SDK for creating and managing browser sessions in Browserbase's cloud infrastructure. Docs -> https://docs.browserbase.com/ -- solveCaptchas: Browserbase browser setting that enables automatic captcha solving for reCAPTCHA, hCaptcha, and other captcha types. Enabled by default for Basic and Advanced Stealth Mode. +- solveCaptchas: Browserbase browser setting that enables automatic CAPTCHA solving. Enabled by default for Basic and Advanced Stealth Mode. Docs -> https://docs.browserbase.com/features/stealth-mode#captcha-solving - console messages: Browser console events that indicate captcha solving status: - `browserbase-solving-started`: emitted when CAPTCHA detection begins @@ -80,7 +80,7 @@ session = bb.sessions.create( ## QUICKSTART -1. `cd python/playwright/basic-recaptcha` +1. `cd python/playwright/basic-captcha-solving` 2. `uv venv venv` 3. `source venv/bin/activate` # On Windows: `venv\Scripts\activate` 4. `uv pip install .` # Install dependencies from pyproject.toml @@ -94,10 +94,10 @@ session = bb.sessions.create( - Creates Browserbase session with captcha solving enabled - Displays session ID and live view link for monitoring - Connects to browser via Chrome DevTools Protocol (CDP) -- Navigates to Google reCAPTCHA demo page -- Waits for Browserbase to automatically solve the captcha (with 60s timeout) -- Logs captcha solving progress messages -- Clicks submit button after captcha is solved +- Navigates to CAPTCHA demo page +- Waits for Browserbase to automatically solve the CAPTCHA (with 60s timeout) +- Logs CAPTCHA solving progress messages +- Clicks submit button after CAPTCHA is solved - Verifies successful captcha solving by checking for success message - Closes session cleanly and displays replay link @@ -105,10 +105,10 @@ session = bb.sessions.create( - Missing credentials: verify .env contains BROWSERBASE_API_KEY - Browser not installed: run `playwright install chromium` to install browser binaries -- Captcha solving timeout: the template uses a 60-second timeout; increase if needed for complex CAPTCHAs +- CAPTCHA solving timeout: the template uses a 60-second timeout; increase if needed for complex CAPTCHAs - No browser context: ensure the Browserbase session was created successfully before connecting - Proxies not enabled: enable proxies in session creation for higher CAPTCHA solving success rates -- Demo page inaccessible: verify the reCAPTCHA demo page URL is accessible and hasn't changed +- Demo page inaccessible: verify the CAPTCHA demo page URL is accessible and hasn't changed - Console message timing: ensure console event listeners are set up before navigating to the page - Custom captcha selectors: for non-standard CAPTCHAs, verify that `captchaImageSelector` and `captchaInputSelector` are correctly defined - Import errors: activate your virtual environment if you created one diff --git a/python/playwright/basic-recaptcha/main.py b/python/playwright/basic-captcha-solving/main.py similarity index 92% rename from python/playwright/basic-recaptcha/main.py rename to python/playwright/basic-captcha-solving/main.py index acb2c6c8..f6e0009c 100644 --- a/python/playwright/basic-recaptcha/main.py +++ b/python/playwright/basic-captcha-solving/main.py @@ -1,4 +1,4 @@ -# Basic reCAPTCHA Solving with Playwright + Browserbase - See README.md for full documentation +# Basic CAPTCHA Solving with Playwright + Browserbase - See README.md for full documentation # # This template uses Playwright directly with the Browserbase SDK for lower-level browser control. # For a higher-level API with natural language commands, see the Stagehand template instead. @@ -36,7 +36,7 @@ def validate_env() -> str: async def main(): - print("Starting Playwright + Browserbase reCAPTCHA Example...") + print("Starting Playwright + Browserbase CAPTCHA Example...") api_key = validate_env() @@ -44,8 +44,7 @@ async def main(): bb = Browserbase(api_key=api_key) # Create a new browser session with captcha solving enabled. - # solveCaptchas: Browserbase setting that enables automatic solving for - # reCAPTCHA, hCaptcha, and other captcha types. + # solveCaptchas: Browserbase setting that enables automatic CAPTCHA solving. # Docs: https://docs.browserbase.com/features/stealth-mode#captcha-solving print("Creating Browserbase session with captcha solving enabled...") session = bb.sessions.create( @@ -90,8 +89,8 @@ def handle_console(msg): page.on("console", handle_console) - # Navigate to Google reCAPTCHA demo page to test captcha solving. - print("Navigating to reCAPTCHA demo page...") + # Navigate to CAPTCHA demo page to test CAPTCHA solving. + print("Navigating to CAPTCHA demo page...") await page.goto(DEMO_URL, wait_until="domcontentloaded") # Wait for Browserbase to solve the captcha automatically. @@ -117,7 +116,7 @@ def handle_console(msg): print(f"Page content: {page_content[:500] if page_content else 'None'}") except Exception as error: - print(f"Error during reCAPTCHA solving: {error}") + print(f"Error during CAPTCHA solving: {error}") raise finally: diff --git a/python/playwright/basic-recaptcha/pyproject.toml b/python/playwright/basic-captcha-solving/pyproject.toml similarity index 82% rename from python/playwright/basic-recaptcha/pyproject.toml rename to python/playwright/basic-captcha-solving/pyproject.toml index 6fae679a..8162629d 100644 --- a/python/playwright/basic-recaptcha/pyproject.toml +++ b/python/playwright/basic-captcha-solving/pyproject.toml @@ -1,7 +1,7 @@ [project] -name = "playwright-basic-recaptcha" +name = "playwright-basic-captcha-solving" version = "0.1.0" -description = "Basic reCAPTCHA solving with Playwright and Browserbase" +description = "Basic CAPTCHA solving with Playwright and Browserbase" readme = "README.md" requires-python = ">=3.9" dependencies = [ diff --git a/typescript/basic-recaptcha/.env.example b/typescript/basic-captcha-solving/.env.example similarity index 100% rename from typescript/basic-recaptcha/.env.example rename to typescript/basic-captcha-solving/.env.example diff --git a/typescript/basic-recaptcha/README.md b/typescript/basic-captcha-solving/README.md similarity index 85% rename from typescript/basic-recaptcha/README.md rename to typescript/basic-captcha-solving/README.md index 2d6e57bf..a3919436 100644 --- a/typescript/basic-recaptcha/README.md +++ b/typescript/basic-captcha-solving/README.md @@ -1,8 +1,8 @@ -# Stagehand + Browserbase: Basic reCAPTCHA Solving +# Stagehand + Browserbase: Basic CAPTCHA Solving ## AT A GLANCE -- Goal: Demonstrate automatic reCAPTCHA solving using Browserbase's built-in captcha solving capabilities. +- Goal: Demonstrate automatic CAPTCHA solving using Browserbase's built-in captcha solving capabilities. - Automated Solving: Browserbase automatically detects and solves CAPTCHAs in the background. CAPTCHA solving is **enabled by default** - you don't need to set `solveCaptchas: true` unless you want to explicitly enable it (or set it to `false` to disable). - Solving Time: CAPTCHA solving typically takes between 5-30 seconds depending on CAPTCHA type and complexity. - Progress Monitoring: Listen for console messages (`browserbase-solving-started`, `browserbase-solving-finished`) to track captcha solving progress in real-time. @@ -12,7 +12,7 @@ ## GLOSSARY -- solveCaptchas: Browserbase browser setting that enables automatic captcha solving for reCAPTCHA, hCaptcha, and other captcha types. Enabled by default for Basic and Advanced Stealth Mode. +- solveCaptchas: Browserbase browser setting that enables automatic CAPTCHA solving. Enabled by default for Basic and Advanced Stealth Mode. Docs → https://docs.browserbase.com/features/stealth-mode#captcha-solving - CAPTCHA solving: When a CAPTCHA is detected, Browserbase attempts to solve it automatically in the background, allowing your automation to continue without manual intervention. - console messages: browser console events that indicate captcha solving status: @@ -41,7 +41,7 @@ Browserbase provides integrated CAPTCHA solving to handle challenges automatical - **Solving Time**: CAPTCHA solving typically takes between 5-30 seconds, depending on the CAPTCHA type and complexity - **Default Behavior**: CAPTCHA solving is enabled by default for Basic and Advanced Stealth Mode - **Proxies**: It's recommended to enable proxies when using CAPTCHA solving for higher success rates -- **Multiple Types**: Browserbase supports reCAPTCHA, hCaptcha, and other common captcha providers automatically +- **Multiple Types**: Browserbase supports common CAPTCHA types automatically ### Custom CAPTCHA Solving @@ -73,7 +73,7 @@ browserSettings: { ## QUICKSTART -1. cd basic-recaptcha +1. cd typescript/basic-captcha-solving 2. pnpm install 3. cp .env.example .env 4. Add your Browserbase API key to .env @@ -83,11 +83,11 @@ browserSettings: { - Initializes Stagehand session with Browserbase - Listens for Browserbase captcha progress through Stagehand V4 console events -- Navigates to Google reCAPTCHA demo page -- Clicks submit button to trigger reCAPTCHA challenge -- Waits for Browserbase to automatically solve the captcha -- Logs captcha solving progress messages -- Clicks submit again after captcha is solved +- Navigates to CAPTCHA demo page +- Clicks submit button to trigger CAPTCHA challenge +- Waits for Browserbase to automatically solve the CAPTCHA +- Logs CAPTCHA solving progress messages +- Clicks submit again after CAPTCHA is solved - Extracts and displays page content - Prints the resulting page content for inspection - Closes session cleanly @@ -98,8 +98,8 @@ browserSettings: { - Captcha solving not enabled: ensure `solveCaptchas: true` is set in browserSettings (enabled by default) - Solving timeout: allow up to 30 seconds for CAPTCHA solving to complete before timing out - Proxies not enabled: enable proxies in browserSettings for higher CAPTCHA solving success rates -- Demo page inaccessible: verify the reCAPTCHA demo page URL is accessible and hasn't changed -- Console message timing: ensure console event listeners are set up before triggering the captcha +- Demo page inaccessible: verify the CAPTCHA demo page URL is accessible and hasn't changed +- Console message timing: ensure console event listeners are set up before triggering the CAPTCHA - Custom captcha selectors: for non-standard CAPTCHAs, verify that `captchaImageSelector` and `captchaInputSelector` are correctly defined ## HELPFUL RESOURCES diff --git a/typescript/basic-recaptcha/index.ts b/typescript/basic-captcha-solving/index.ts similarity index 84% rename from typescript/basic-recaptcha/index.ts rename to typescript/basic-captcha-solving/index.ts index ce5e4d80..55784dab 100644 --- a/typescript/basic-recaptcha/index.ts +++ b/typescript/basic-captcha-solving/index.ts @@ -1,11 +1,11 @@ -// Basic reCAPTCHA Solving with Browserbase - See README.md for full documentation +// Basic CAPTCHA Solving with Browserbase - See README.md for full documentation import "dotenv/config"; import { browserbase, Stagehand } from "@browserbasehq/stagehand"; async function main() { // Initialize Stagehand with Browserbase for cloud-based browser automation. - // Enable captcha solving in browser settings for automatic reCAPTCHA handling. + // Enable captcha solving in browser settings for automatic CAPTCHA handling. const solveCaptchas = true; // Set to false to disable automatic captcha solving (true by default) @@ -23,8 +23,8 @@ async function main() { console.log("Stagehand initialized successfully!"); const page = (await browser.context.pages())[0]; - // Navigate to Google reCAPTCHA demo page to test captcha solving. - console.log("Navigating to reCAPTCHA demo page..."); + // Navigate to CAPTCHA demo page to test CAPTCHA solving. + console.log("Navigating to CAPTCHA demo page..."); await page.goto("https://google.com/recaptcha/api2/demo"); // Wait for Browserbase to solve the captcha automatically. @@ -60,8 +60,8 @@ async function main() { console.log("Captcha solving is disabled. Skipping wait..."); } - // Click submit again after captcha is solved to complete the form submission. - console.log("Clicking submit button after captcha is solved..."); + // Click submit again after CAPTCHA is solved to complete the form submission. + console.log("Clicking submit button after CAPTCHA is solved..."); await stagehand.act("Click the Submit button"); // Extract and display the page content after submission. @@ -70,7 +70,7 @@ async function main() { console.log("Page content:"); console.log(text); } catch (error) { - console.error("Error during reCAPTCHA solving:", error); + console.error("Error during CAPTCHA solving:", error); } finally { // Always close session to release resources and clean up. await stagehand.close(); @@ -80,7 +80,7 @@ async function main() { } main().catch((err) => { - console.error("Error in reCAPTCHA solving example:", err); + console.error("Error in CAPTCHA solving example:", err); console.error("Common issues:"); console.error(" - Check .env file has BROWSERBASE_API_KEY"); console.error(" - Verify solveCaptchas is enabled in browserSettings"); diff --git a/typescript/basic-recaptcha/package.json b/typescript/basic-captcha-solving/package.json similarity index 91% rename from typescript/basic-recaptcha/package.json rename to typescript/basic-captcha-solving/package.json index bf5424ca..ee5ceab2 100644 --- a/typescript/basic-recaptcha/package.json +++ b/typescript/basic-captcha-solving/package.json @@ -1,5 +1,5 @@ { - "name": "basic-recaptcha", + "name": "basic-captcha-solving", "version": "1.0.0", "private": true, "type": "module", diff --git a/typescript/playwright/basic-recaptcha/.env.example b/typescript/playwright/basic-captcha-solving/.env.example similarity index 100% rename from typescript/playwright/basic-recaptcha/.env.example rename to typescript/playwright/basic-captcha-solving/.env.example diff --git a/typescript/playwright/basic-recaptcha/README.md b/typescript/playwright/basic-captcha-solving/README.md similarity index 86% rename from typescript/playwright/basic-recaptcha/README.md rename to typescript/playwright/basic-captcha-solving/README.md index 54ac5679..9ac2d0aa 100644 --- a/typescript/playwright/basic-recaptcha/README.md +++ b/typescript/playwright/basic-captcha-solving/README.md @@ -1,8 +1,8 @@ -# Playwright + Browserbase: Basic reCAPTCHA Solving +# Playwright + Browserbase: Basic CAPTCHA Solving ## AT A GLANCE -- Goal: Demonstrate automatic reCAPTCHA solving using Playwright with Browserbase's built-in captcha solving capabilities. +- Goal: Demonstrate automatic CAPTCHA solving using Playwright with Browserbase's built-in captcha solving capabilities. - Automated Solving: Browserbase automatically detects and solves CAPTCHAs in the background. CAPTCHA solving is **enabled by default** - you don't need to set `solveCaptchas: true` unless you want to explicitly enable it (or set it to `false` to disable). - Timeout Handling: Includes 60-second timeout to prevent indefinite waits on captcha solving failures. - Progress Monitoring: Listen for console messages (`browserbase-solving-started`, `browserbase-solving-finished`) to track captcha solving progress in real-time. @@ -12,7 +12,7 @@ - Browserbase SDK: JavaScript/TypeScript SDK for creating and managing browser sessions in Browserbase's cloud infrastructure. Docs -> https://docs.browserbase.com/ -- solveCaptchas: Browserbase browser setting that enables automatic captcha solving for reCAPTCHA, hCaptcha, and other captcha types. Enabled by default for Basic and Advanced Stealth Mode. +- solveCaptchas: Browserbase browser setting that enables automatic CAPTCHA solving. Enabled by default for Basic and Advanced Stealth Mode. Docs -> https://docs.browserbase.com/features/stealth-mode#captcha-solving - console messages: Browser console events that indicate captcha solving status: - `browserbase-solving-started`: emitted when CAPTCHA detection begins @@ -67,7 +67,7 @@ browserSettings: { ## QUICKSTART -1. cd typescript/playwright/basic-recaptcha +1. cd typescript/playwright/basic-captcha-solving 2. pnpm install 3. cp .env.example .env 4. Add your Browserbase API key to .env @@ -79,20 +79,20 @@ browserSettings: { - Creates Browserbase session with captcha solving enabled - Displays session ID and live view link for monitoring - Connects to browser via Chrome DevTools Protocol (CDP) -- Navigates to Google reCAPTCHA demo page -- Waits for Browserbase to automatically solve the captcha (with 60s timeout) -- Logs captcha solving progress messages -- Clicks submit button after captcha is solved +- Navigates to CAPTCHA demo page +- Waits for Browserbase to automatically solve the CAPTCHA (with 60s timeout) +- Logs CAPTCHA solving progress messages +- Clicks submit button after CAPTCHA is solved - Verifies successful captcha solving by checking for success message - Closes session cleanly and displays replay link ## COMMON PITFALLS - Missing credentials: verify .env contains BROWSERBASE_API_KEY -- Captcha solving timeout: the template uses a 60-second timeout; increase if needed for complex CAPTCHAs +- CAPTCHA solving timeout: the template uses a 60-second timeout; increase if needed for complex CAPTCHAs - No browser context: ensure the Browserbase session was created successfully before connecting - Proxies not enabled: enable proxies in browserSettings for higher CAPTCHA solving success rates -- Demo page inaccessible: verify the reCAPTCHA demo page URL is accessible and hasn't changed +- Demo page inaccessible: verify the CAPTCHA demo page URL is accessible and hasn't changed - Console message timing: ensure console event listeners are set up before navigating to the page - Custom captcha selectors: for non-standard CAPTCHAs, verify that `captchaImageSelector` and `captchaInputSelector` are correctly defined diff --git a/typescript/playwright/basic-recaptcha/index.ts b/typescript/playwright/basic-captcha-solving/index.ts similarity index 91% rename from typescript/playwright/basic-recaptcha/index.ts rename to typescript/playwright/basic-captcha-solving/index.ts index ec89cac6..232b82fb 100644 --- a/typescript/playwright/basic-recaptcha/index.ts +++ b/typescript/playwright/basic-captcha-solving/index.ts @@ -1,4 +1,4 @@ -// Basic reCAPTCHA Solving with Playwright + Browserbase - See README.md for full documentation +// Basic CAPTCHA Solving with Playwright + Browserbase - See README.md for full documentation // // This template uses Playwright directly with the Browserbase SDK for lower-level browser control. // For a higher-level API with natural language commands, see the Stagehand template instead. @@ -23,7 +23,7 @@ function validateEnv(): { apiKey: string } { } async function main() { - console.log("Starting Playwright + Browserbase reCAPTCHA Example..."); + console.log("Starting Playwright + Browserbase CAPTCHA Example..."); const { apiKey } = validateEnv(); @@ -31,7 +31,7 @@ async function main() { const bb = new Browserbase({ apiKey }); // Create a new browser session with captcha solving enabled. - // solveCaptchas: Browserbase setting that enables automatic solving for reCAPTCHA, hCaptcha, and other captcha types. + // solveCaptchas: Browserbase setting that enables automatic CAPTCHA solving. // Docs: https://docs.browserbase.com/features/stealth-mode#captcha-solving console.log("Creating Browserbase session with captcha solving enabled..."); const session = await bb.sessions.create({ @@ -85,8 +85,8 @@ async function main() { }); } - // Navigate to Google reCAPTCHA demo page to test captcha solving. - console.log("Navigating to reCAPTCHA demo page..."); + // Navigate to CAPTCHA demo page to test CAPTCHA solving. + console.log("Navigating to CAPTCHA demo page..."); await page.goto(DEMO_URL, { waitUntil: "domcontentloaded" }); // Wait for Browserbase to solve the captcha automatically. @@ -117,7 +117,7 @@ async function main() { const pageContent = await page.textContent("body"); console.log("Page content:", pageContent?.substring(0, 500)); } catch (error) { - console.error("Error during reCAPTCHA solving:", error); + console.error("Error during CAPTCHA solving:", error); throw error; } finally { // Always close the browser to release resources and end the Browserbase session. diff --git a/typescript/playwright/basic-recaptcha/package.json b/typescript/playwright/basic-captcha-solving/package.json similarity index 83% rename from typescript/playwright/basic-recaptcha/package.json rename to typescript/playwright/basic-captcha-solving/package.json index a02d257e..848a01f2 100644 --- a/typescript/playwright/basic-recaptcha/package.json +++ b/typescript/playwright/basic-captcha-solving/package.json @@ -1,5 +1,5 @@ { - "name": "playwright-basic-recaptcha-template", + "name": "playwright-basic-captcha-solving-template", "type": "module", "scripts": { "build": "tsc",