testdrivermaking-assertionslisted
Install: claude install-skill testdriverai/testdriverai
<!-- Generated from making-assertions.mdx. DO NOT EDIT. -->
After a test runs, make sure that the app did the correct thing. Validation has two parts: to find the elements that you want to check, and to make assertions about the state of your app. TestDriver uses the AI as a judge. It returns a boolean and the reason. This shows if your app is in the correct state.
## Locating Elements
### Locating Single Elements
Use natural language to describe elements. A description must be specific enough to find the element. But it must not be so specific that it breaks with small UI changes. For example:
```javascript
await testdriver.find('email input field');
await testdriver.find('first product card in the grid');
await testdriver.find('dropdown menu labeled "Country"');
```
<Info>TestDriver caches the found elements for better performance on later calls. Read more about [element caching here](/caching).</Info>
### Debugging Found Elements
After TestDriver finds an element, you can look at its properties for debug:
```javascript
const button = await testdriver.find('submit button');
console.log(button);
```
This outputs all element properties:
```javascript
{
description: 'submit button',
found: true,
x: 150,
y: 300,
coordinates: { x: 150, y: 300, centerX: 200, centerY: 320 },
threshold: 0.8,
confidence: 0.95,
similarity: 0.92,
selector: 'button[type="submit"]',
cache: {
hit: true,
strategy: 'pixel-diff',
createdAt: '2025-01-15T10:30:00Z',