Selenium
Connect Selenium WebDriver to a Scrayle cloud browser for stealth-enabled automation. The SDK provisions a session on the internal grid and returns a ready WebDriver - no grid setup required.
Prerequisites
npm install @scrayle/sdkThe SDK includes selenium-webdriver as a dependency. No separate installation is needed.
Cloud Browser
Use SeleniumBrowser.connect() to provision a Scrayle-managed Selenium session:
import { SeleniumBrowser } from '@scrayle/sdk';
const driver = await SeleniumBrowser.connect({
apiKey: process.env.SCRAYLE_API_KEY,
});
await driver.get('https://example.com');
console.log(await driver.getTitle());
await driver.quit();With Proxy
const driver = await SeleniumBrowser.connect({
apiKey: process.env.SCRAYLE_API_KEY,
proxyCountry: 'US',
});
await driver.get('https://example.com');
await driver.quit();All Connect Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | SCRAYLE_API_KEY | Scrayle API key |
scrayleHub | string | eu | Compute hub: eu, us, asia |
proxyCountry | string | - | Proxy exit country (e.g. US, GB) |
proxyPoolId | string | - | ID of a saved proxy pool |
sessionName | string | - | Label shown in the dashboard |
headless | boolean | true | Run in headless mode |
windowSize | object | 1280x800 | Browser window dimensions |
sessionTTL | number | 300000 | Session lifetime in ms (max per plan) |
Stealth Features
All Selenium sessions include the same CDP-based stealth patches as Playwright and Puppeteer sessions:
- WebDriver flag removed
- Randomised navigator fingerprint (UA, viewport, locale, timezone)
- WebGL vendor masking
- Chrome runtime injection
- Geo-synced timezone and language from live proxy IP
Local / Self-hosted
Use SeleniumBrowser.launch() to drive a local Chromium binary or a self-hosted Selenium Grid:
import { SeleniumBrowser } from '@scrayle/sdk';
// Local Chromium - auto-detected from common binary paths
const driver = await SeleniumBrowser.launch({ headless: true });
// Self-hosted grid
const driver = await SeleniumBrowser.launch({
remoteUrl: 'http://your-selenium-grid:4444',
});
await driver.get('https://example.com');
await driver.quit();launch() does not use Scrayle cloud credits. Credits are only consumed by connect() sessions.