Dealing with tables sucks. Locators are brittle, hard to read, and break the moment a column moves or pagination kicks in.
Playwright Smart Table lets you find rows by column name instead of fragile DOM positions. You describe your table — it does the rest.
// ❌ Before — breaks if columns reorder
const row = page.locator('tbody tr')
.filter({ has: page.locator('td:nth-child(1)', { hasText: 'John' }) })
.filter({ has: page.locator('td:nth-child(2)', { hasText: 'Doe' }) })
const email = await row.locator('td:nth-child(3)').innerText()// ✅ After — column-aware, survives reordering
const row = table.getRow({ firstName: 'John', lastName: 'Doe' })
const email = await row.getCell('Email').innerText()npm install @rickcedwhat/playwright-smart-tableimport { useTable } from '@rickcedwhat/playwright-smart-table';
const table = await useTable(page.locator('#my-table')).init();
const row = table.getRow({ Name: 'John Doe' });
const email = await row.getCell('Email').innerText();- Row access — find rows by column name, not DOM index
- Pagination search —
findRowandfindRowsscan across pages automatically - Iteration —
forEach,map,filter, with early exit viastop() - Table config — plug in any pagination shape, virtual scroll, or custom header logic
- Fill / edit cells — write values back into table cells
- Documentation
- npm Package
- GitHub Repository
- Issues
- Discussions — questions and ideas
MIT © Cedrick Catalan