Documentation

Golang SDK

Official Go SDK for the Browser Cloud API. A high-level interface for controlling cloud browsers, executing JavaScript, and managing browser sessions.

Installation

Install the Browser Cloud Go SDK using go get:

Package: wrc-beta.xyz/wrc_go

Install: go get wrc-beta.xyz/wrc_go

Quick Start

Here's a simple example to get you started:

package main

import (
    "context"
    "fmt"
    "wrc-beta.xyz/wrc_go"
)

func main() {
    ctx := context.Background()
    
    // Rent a browser session
    browser, err := wrc_go.RentBrowser(
        ctx,
        "your-api-key",
        300, // rent time in seconds (5 minutes)
        "",  // proxy host (required)
        0,   // proxy port (required)
        "",  // proxy username (optional)
        "",  // proxy password (optional)
        "",  // country code (optional, "" for auto)
        "",  // timezone (optional, "" for auto)
        "",  // blob name for static files (optional)
    )
    if err != nil {
        panic(err)
    }
    defer browser.StopBrowser(ctx)
    
    // Navigate to a page
    err = browser.Navigate(ctx, "https://example.com", 30000)
    if err != nil {
        panic(err)
    }
    
    // Wait for an element to appear in the main frame
    err = browser.WaitForSelector(
        ctx,
        `a[href="https://iana.org/domains/example"]`,
        30000,
    )
    if err != nil {
        panic(err)
    }
    
    // Click an element
    err = browser.ClickSelector(
        ctx,
        `a[href="https://iana.org/domains/example"]`,
    )
    if err != nil {
        panic(err)
    }
    
    fmt.Println("Success!")
}

Features

  • Browser Automation: Navigate, click elements, and interact with web pages
  • JavaScript Execution: Run JavaScript code in browser contexts
  • Frame Management: Work with multiple frames and iframes
  • Request/Response Interception: Monitor and modify network requests
  • Static File Injection: Upload and serve custom static files
  • Session Management: Handle authentication and session persistence
  • Cookie Management: Get, set, and clear cookies
  • Captcha Solving: Solve supported captchas (PerimeterX, Cloudflare Turnstile, DataDome)

Next Steps

For complete API documentation including all types, functions, parameters, and return values, see the API Reference.

View API Reference →