Crafted Node.js browser automation built directly on the WebDriver protocol.
Think of it as a modern take on Selenium with automatic waits and ergonomic API, while staying true to the W3C standards so your tests stay stable across real browsers.
npm install craftdriverQuick example:
import { Browser } from 'craftdriver';
const browser = await Browser.launch({ browserName: 'chrome' });
await browser.navigateTo('http://127.0.0.1:8080/login.html');
await browser.fill('#username', 'testuser');
await browser.fill('#password', 'secret');
await browser.click('#submit');
await browser.expect('#result').toHaveText('Welcome testuser');
await browser.quit();Mobile emulation:
const browser = await Browser.launch({
browserName: 'chrome',
mobileEmulation: 'iPhone 14',
});Network mocking:
const browser = await Browser.launch({
browserName: 'chrome',
enableBiDi: true,
});
await browser.network.mock('**/api/users', {
status: 200,
body: { users: [] },
});Session persistence:
await browser.saveState('./session.json');
// Later: restore with storageState option
const browser2 = await Browser.launch({
browserName: 'chrome',
storageState: './session.json',
});- Simple API - Easy to use, works as expected
- TypeScript-first - Full type definitions included
- Flexible locators - CSS, XPath, text, role, and semantic selectors that stay stable
- Bulletproof interactions - Reliable element, mouse, and keyboard control
- Auto-waiting - Smart waits built into all actions
- Real browsers - Test on actual Chrome, Edge, and other W3C-compliant browsers
- Mobile emulation - Test responsive designs with device presets (iPhone, Pixel, iPad)
- Session persistence - Save/load cookies and localStorage
- Network mocking - Intercept and mock HTTP requests
- Console/Error logs - Capture browser console messages
| Guide | Description |
|---|---|
| Getting Started | Installation, prerequisites, and first test |
| Browser API | Core browser control: navigation, clicks, forms |
| Element API | ElementHandle methods for interacting with elements |
| Selectors | CSS, XPath, and semantic locators (By helpers) |
| Assertions | Built-in expect API for testing |
| Keyboard & Mouse | Low-level input simulation |
| Session Management | Cookies, localStorage, and session persistence |
| Screenshots | Capturing page and element screenshots |
| Mobile Emulation | Test with mobile device viewports and touch events |
| BiDi Features | Network mocking and console log capture |
PRs and issues are welcome. Be kind. Brew great tests.
MIT