Skip to main content
View and manage the intelligent cache that powers TestDriver’s fast test execution. Browse all cached element locations, see visual previews, and clear cache when needed.

Selector Cache Dashboard

Access cache management at app.testdriver.ai/cache:

Selector Cache

Browse all cached selector entries with visual previews

Cache Overview

The cache stores AI vision analysis results for faster test execution:

Cache Hit Rate

Percentage of selectors found in cache
  • Higher is better
  • Typical: 80-95% after a few runs
  • Shows cache effectiveness

Total Entries

Number of cached selectors
  • Grows with test diversity
  • Automatically managed
  • Cleared on code changes

Cache Size

Storage used by cache
  • Screenshots + metadata
  • Typical: 10-500 MB
  • Automatic cleanup

Minimum Hits

Filter by cache usage
  • 0 = Show all entries
  • 5+ = Show frequently used
  • Optimize cache value

Viewing Cache Entries

Each cached entry shows:
Cache Entry Example:
┌────────────────────────────────────────────────────┐
│ Selector: "Sign in, black button below password"  │
│                                                    │
│ [Screenshot Preview]                               │
│ ┌─────────────────┐                               │
│ │                 │                               │
│ │  [Found Element]│  ← Visual target              │
│ │                 │                               │
│ └─────────────────┘                               │
│                                                    │
│ File: test/testdriver.test.js                     │
│ Context: by "standard_user" password field        │
│ Hash: a8f3c21b...                                 │
│ Status: ✓ Passed                                   │
│                                                    │
│ [TEST] [single] [windows] [s blac]                │
│ [fe68cfe63c784b2a47...] [hover:start-test]       │
└────────────────────────────────────────────────────┘

Entry Information

  • Selector Text - Natural language description used
  • Screenshot - Visual preview showing found element
  • File - Which test file used this selector
  • Context - Additional selector context
  • Hash - Unique cache key identifier
  • Status - Whether element was found
  • Tags - Test metadata and labels

Cache Key Generation

Understanding how cache keys work:
Cache Key Components:
1. Test File Hash: SHA-256 of test file contents
2. Selector Text: "submit button"
3. Screenshot Hash: Perceptual hash of screen
4. Platform: linux, windows, mac

Combined Key: 
fe68cfe63c784b2a47bcd8a8f3c21b7e
Cache Invalidation:
  • Test file changes → New hash → Fresh cache
  • UI changes → Different screenshot → New entry
  • Selector changes → Different text → New entry
  • Platform changes → Separate cache per OS
Visual browse mode for cache entries:
[Selector Cache - Gallery View]
┌──────────┬──────────┬──────────┬──────────┐
│          │          │          │          │
│  [IMG]   │  [IMG]   │  [IMG]   │  [IMG]   │
│  login   │  submit  │  menu    │  cart    │
│  button  │  button  │  icon    │  button  │
│          │          │          │          │
├──────────┼──────────┼──────────┼──────────┤
│          │          │          │          │
│  [IMG]   │  [IMG]   │  [IMG]   │  [IMG]   │
│  search  │  profile │  logout  │  save    │
│  input   │  avatar  │  link    │  button  │
│          │          │          │          │
└──────────┴──────────┴──────────┴──────────┘
Features:
  • Click to enlarge screenshot
  • Hover to see full selector text
  • Color-coded by status (green = found, red = not found)
  • Sort by usage frequency

Table View

Detailed list with sortable columns:
[Selector Cache - Table View]
┌─────────────────────┬──────────┬─────────┬────────┬──────────┐
│ Selector            │ Preview  │ File    │ Status │ Cache Key│
├─────────────────────┼──────────┼─────────┼────────┼──────────┤
│ Sign in, black btn  │ [thumb]  │ test.js │ PASSED │ fe68cfe..│
│ password input      │ [thumb]  │ test.js │ PASSED │ a8f3c21..│
│ username field      │ [thumb]  │ test.js │ PASSED │ 7b2d4e9..│
│ submit button       │ [thumb]  │ test.js │ NOTFND │ c5a1f8e..│
└─────────────────────┴──────────┴─────────┴────────┴──────────┘

Sort by: ▼ Selector | File | Status | Usage

Filtering Cache Entries

Find specific cached items:
Filter by Cache Key:
All cache keys
fe68cfe6... (specific hash)
a8f3c21b... (specific hash)

Cache Statistics

Per-file and global metrics:
Cache Performance:
┌────────────────────────────────────────────────────┐
│ test/login.test.js                                │
│ • Entries: 12                                     │
│ • Hit Rate: 95%                                   │
│ • Avg Match Time: 15ms                            │
│ • Total Saves: ~28 seconds per run                │
├────────────────────────────────────────────────────┤
│ test/checkout.test.js                             │
│ • Entries: 23                                     │
│ • Hit Rate: 87%                                   │
│ • Avg Match Time: 18ms                            │
│ • Total Saves: ~52 seconds per run                │
└────────────────────────────────────────────────────┘

Global Stats:
• Total Cached Selectors: 156
• Overall Hit Rate: 91%
• Total Time Saved: 8.5 minutes per full suite
• Cache Size: 143 MB

Clear Cache

Manage cache storage:

Clear All

Remove all cache entries
  • Fresh start
  • Reclaim storage
  • Force re-analysis

Clear by File

Remove specific test file cache
  • After UI changes
  • Test refactoring
  • Targeted cleanup

Clear Failed

Remove not-found entries
  • Clean up misses
  • Reduce cache size
  • Keep only successful matches

Clear Old

Remove entries older than X days
  • Automatic cleanup
  • Keep recent only
  • Configurable threshold
Clearing cache will slow down the next test run as TestDriver rebuilds the cache with AI vision analysis.

Cache Configuration

Customize caching behavior:
import { test } from 'vitest';
import { chrome } from 'testdriverai/presets';

test('cache configuration', async (context) => {
  const { testdriver } = await chrome(context, {
    url: 'https://example.com',
    cache: {
      enabled: true,           // Enable/disable caching
      ttl: 30 * 24 * 60 * 60, // 30 days in seconds
      threshold: 0.85,         // 85% similarity threshold
      maxSize: 500 * 1024 * 1024 // 500 MB max cache size
    }
  });
});

Cache Matching Strategies

TestDriver uses three-tier matching:
1

Exact Hash Match

Fastest - Perceptual hash comparison
  • Speed: < 1ms
  • Accuracy: 100%
  • Use case: Identical screenshots
2

Pixel Diff Match

Fast - Pixel-by-pixel comparison
  • Speed: < 50ms
  • Accuracy: 95%+ similarity
  • Use case: Minor UI changes (hover states)
3

Template Match

Fallback - Edge detection and structure
  • Speed: < 200ms
  • Accuracy: 75%+ confidence
  • Use case: Layout changes, responsive design

Found Targets Preview

See exactly what elements were cached:
Target Details:
┌────────────────────────────────────────────────────┐
│ Element Found: ✓                                  │
│                                                    │
│ Coordinates: (512, 387)                           │
│ Bounding Box:                                     │
│   X: 450, Y: 370                                  │
│   Width: 124, Height: 34                          │
│                                                    │
│ Visual Preview:                                    │
│ [Screenshot with highlight box around element]    │
│                                                    │
│ Confidence: 98.5%                                 │
│ Match Type: Exact Hash                            │
│ Match Time: 12ms                                  │
└────────────────────────────────────────────────────┘

Export Cache Data

Download cache information:
{
  "cache": [
    {
      "selector": "Sign in, black button below password",
      "file": "test/testdriver.test.js",
      "cacheKey": "fe68cfe63c784b2a",
      "status": "PASSED",
      "coordinates": { "x": 512, "y": 387 },
      "timestamp": "2024-12-09T10:30:00Z",
      "hits": 45
    }
  ]
}

Learn More