Use this file to discover all available pages before exploring further.
TestDriver is engineered for performance with intelligent caching that delivers up to 1.7x faster test execution by skipping redundant AI vision analysis.
// First run: builds cacheawait testdriver.find('submit button');// Second run: exact matchawait testdriver.find('submit button');
Caching is enabled automatically with zero configuration. The cache key is computed from:
File hash: SHA-256 hash of the test file contents
Selector prompt: The exact text description passed to find()
Screenshot context: Perceptual hash of the current screen state
Platform: Operating system and browser version
When you modify your test file, the hash changes automatically, invalidating stale cache entries and ensuring fresh AI analysis with your updated test logic.
import { test } from 'vitest';import { chrome } from 'testdriverai/presets';test('auto-cached test', async (context) => { const { testdriver } = await chrome(context, { url: 'https://example.com' }); // First call: AI analyzes screen, saves to cache await testdriver.find('More information link'); // 2.1s // Second call: cache hit, instant response await testdriver.find('More information link'); // 12ms ⚡});
You can clear the cache within the TestDriver console. There, you’ll also find previews of cached elements, the input prompts, as well as analytics on cache hit rates.
TestDriver Cache
Manage and clear your test cache from the TestDriver console.
Custom cache keys prevent cache pollution when using variables in prompts, dramatically improving cache hit rates.
// ❌ Without cache key - creates new cache for each variable valueconst email = 'user@example.com';await testdriver.find(`input for ${email}`); // Cache miss every time// ✅ With cache key - reuses cache regardless of variableconst email = 'user@example.com';await testdriver.find(`input for ${email}`, { cacheKey: 'email-input'});// Also useful for dynamic IDs, names, or other changing dataconst orderId = generateOrderId();await testdriver.find(`order ${orderId} status`, { cacheKey: 'order-status' // Same cache for all orders});