Skip to content

Examples

Real-world examples of using Playwright Smart Table with different table libraries and patterns.

Common Patterns

Finding and Asserting

typescript
const row = await table.findRow({ Name: 'John Doe' });
await expect(row.getCell('Email')).toHaveText('john@example.com');

Filtering and Iteration

typescript
const engineers = await table.findRows({ Department: 'Engineering' });

for (const engineer of engineers) {
  const name = await engineer.getCell('Name').textContent();
  console.log(name);
}

Data Export

typescript
const rows = await table.findRows({});
const data = await rows.toJSON();
console.log(JSON.stringify(data, null, 2));

Editing Cells

typescript
const row = await table.findRow({ ID: '12345' });
await row.smartFill({
  Email: 'new.email@example.com',
  Phone: '555-1234'
});

Browse Examples

Click on the links above to see detailed examples for each use case.