TypeScript SDK
Official TypeScript 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 TypeScript SDK using the latest tarball:
Install: npm install https://wrc-beta.xyz/wrc-ts/latest.tgz
Quick Start
Here's a simple example to get you started:
import { rentBrowser } from "wrc-ts";
async function run() {
// Rent a browser session
const browser = await rentBrowser(
"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)
);
try {
// Navigate to a page
await browser.navigate("https://example.com", 30000);
// Wait for an element to appear in the main frame
await browser.waitForSelector(
'a[href="https://iana.org/domains/example"]',
30000,
);
// Click an element
await browser.clickSelector('a[href="https://iana.org/domains/example"]');
console.log("Success!");
} finally {
await browser.stopBrowser();
}
}
run().catch(console.error);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 →