Skip to content

Playwright Smart Table

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
typescript
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
typescript
const row = table.getRow({ firstName: 'John', lastName: 'Doe' })
const email = await row.getCell('Email').innerText()