SmartRow
A SmartRow is a Playwright Locator extended with table-aware methods. Every method that returns a row (getRow, findRow, iteration callbacks, etc.) returns a SmartRow.
Because SmartRow extends Locator, all standard Playwright locator methods — click(), innerText(), waitFor(), locator(), etc. — are available directly on the row.
Properties
rowIndex
Signature
rowIndex?: numberThe 0-based row index within the table, if known. Set by findRow, findRows, getRowByIndex, filter, and async iteration. May be undefined when returned by getRow.
const row = await table.findRow({ Name: 'John' });
console.log(row.rowIndex); // e.g. 12tablePageIndex
Signature
tablePageIndex?: numberThe 0-based page index this row was found on during pagination. Set alongside rowIndex by async operations.
table
Signature
table: TableResult<T>Reference back to the parent TableResult. Useful when passing rows between helpers.
Methods
getCell
Signature
getCell(columnName: string): LocatorParameters
column- Column name (case-sensitive)
Returns a SmartCell (Locator + bringIntoView) for the named column. Column name is case-sensitive.
const emailCell = row.getCell('Email');
await expect(emailCell).toHaveText('john@example.com');
// SmartCell also exposes bringIntoView
await row.getCell('Notes').bringIntoView();toJSON
Signature
toJSON(options?: { columns?: string[] }): Promise<T>Parameters
options- Optional configuration
Reads all (or specified) columns and returns a plain object.
const data = await row.toJSON();
// { Name: 'John', Email: 'john@example.com', Status: 'Active' }
const partial = await row.toJSON({ columns: ['Name', 'Status'] });
// { Name: 'John', Status: 'Active' }bringIntoView
Signature
bringIntoView(): Promise<void>Scrolls and/or paginates to make this row visible. Requires rowIndex to be set — works when the row was returned by findRow, findRows, getRowByIndex, filter, or async iteration.
const rows = await table.findRows({ Status: 'Flagged' });
for (const row of rows) {
await row.bringIntoView();
await expect(row.getCell('Status')).toBeVisible();
}WARNING
Throws if rowIndex is unknown (e.g., rows from getRow).
smartFill
Signature
smartFill(
data: Partial<T>,
options?: FillOptions
): Promise<void>Parameters
data- Column-value pairs to filloptions- Optional configuration
Fills form fields in the row. Auto-detects input type (text, select, checkbox, contenteditable). Uses columnOverrides.write when configured.
await row.smartFill({ Name: 'Jane', Status: 'Active', Subscribe: true });
// Custom input mapper for a non-standard input
await row.smartFill(
{ Notes: 'Updated' },
{ inputMappers: { Notes: (cell) => cell.locator('.rich-text-editor') } }
);wasFound
Signature
wasFound(): booleanReturns false if this is a sentinel "not found" row (e.g., when findRow finds no match in a non-throwing mode). Returns true for any real row.
const row = await table.findRow({ Name: 'Ghost' });
if (!row.wasFound()) {
console.log('Row not found');
}