AI-Powered Playwright.
Zero Rewrites.
Sentinel adds natural language actions, self-healing locators, and autonomous agents to Playwright — without replacing it. One import, one extra method, your tests stay intact.
The problem with selectors
Every Playwright test is coupled to the DOM. When the UI changes — and it always does — tests break. Sentinel decouples your intent from the implementation.
Before — Plain Playwright
// Plain Playwright — fragile selectors
await page.click('#email-input');
await page.fill('#email-input', 'user@example.com');
await page.click('button[type="submit"]');
// Every UI change breaks your tests.
// Find the new selector, update, repeat.After — Sentinel
// Sentinel — natural language, self-healing
await ai.act('fill the email field with user@example.com');
await ai.act('click the sign in button');
// Sentinel finds the element itself.
// When the UI changes, it re-discovers it automatically.Three ways to adopt
Extend any page
sentinel.extend(page) adds AI methods to an existing Playwright Page. Zero test restructuring.
ai test fixture
import { test } from '@isoldex/sentinel/test' — the ai fixture works alongside page and browser.
Autonomous agent
sentinel.run(goal) takes over and completes multi-step flows without step-by-step scripting.
Path 1 — extend(page)
import { chromium } from 'playwright';
import { Sentinel } from '@isoldex/sentinel';
const browser = await chromium.launch();
const page = await browser.newPage();
// One line to add AI to an existing page
const ai = await Sentinel.extend(page, {
apiKey: process.env.GEMINI_API_KEY,
});
await page.goto('https://myapp.com');
// Mix AI actions with standard Playwright
await ai.act('click the login button');
await page.waitForURL('/dashboard'); // standard Playwright
await expect(page.locator('h1')).toBeVisible(); // standard Playwright
const data = await ai.extract('get user name', { name: 'string' });Path 2 — Playwright Test fixture
// playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
sentinelOptions: {
apiKey: process.env.GEMINI_API_KEY,
enableCaching: true, // near-zero cost on repeated runs
headless: true,
},
},
});// search.spec.ts
import { test, expect } from '@isoldex/sentinel/test';
test('search and extract results', async ({ page, ai }) => {
await page.goto('https://news.ycombinator.com');
// AI action
const stories = await ai.extract(
'Get the top 5 story titles and their point counts',
{ stories: [{ title: 'string', points: 'number' }] }
);
expect(stories.stories).toHaveLength(5);
expect(stories.stories[0].title).toBeTruthy();
});Path 3 — Autonomous agent
// Let the agent figure out the whole flow
const result = await sentinel.run(
'Log in with credentials from env, navigate to settings, ' +
'enable 2FA, and extract the backup codes',
{ maxSteps: 30 }
);
console.log(result.goalAchieved); // true
console.log(result.data); // { backupCodes: [...] }Plain Playwright vs. Sentinel
Sentinel is additive — it doesn't replace Playwright, it enhances it.
| Capability | Plain Playwright | Playwright + Sentinel |
|---|---|---|
| Element targeting | CSS selectors / roles | Natural language |
| When UI changes | Tests break, manual fix | Self-healing — auto re-discovers |
| Dynamic pages | Requires knowing selectors | Observes + acts on what's visible |
| Shadow DOM / iframes | partial | ✓ |
| Autonomous multi-step | ✗ | yes (run() agent loop) |
| Data extraction | Requires selectors + parsing | extract() returns typed objects |
| Existing test migration | — | extend(page) — one line |
| Works with expect() | ✓ | yes — fully compatible |
| Cost per run | — | ~$0.002 (Gemini Flash) |
| OpenTelemetry tracing | ✗ | ✓ |
What you gain
Self-healing locators
Successful selectors are cached and reused. When the DOM changes, Sentinel re-discovers the element automatically — no manual fix needed.
Natural language actions
Write what you want, not how to find it. act('click the checkout button') works regardless of the underlying selector.
Autonomous agent mode
run(goal) plans and executes multi-step flows without scripting each step. Handles unknown page states, dynamic content, and unexpected redirects.
Typed data extraction
extract('get product name and price', schema) returns fully typed data — no selector hunting, no innerHTML parsing.
OpenTelemetry tracing
Every AI action emits a span. Drop into Datadog, Grafana, or Jaeger to see exactly what Sentinel did, for how long, and at what cost.
~$0.002 per run
Gemini Flash is 40× cheaper than GPT-4o. With self-healing locators and prompt caching, repeated runs cost effectively zero.
Add AI to Playwright in 5 minutes
One install. One import. Your existing tests stay exactly as they are.