Debugging Guide â
How to diagnose issues when the library can't find your row or column.
Enable Debug Logs â
The easiest way to see what's happening is to enable logging in the table config.
typescript
const table = useTable(loc, {
debug: {
logLevel: 'verbose', // 'none' | 'error' | 'info' | 'verbose'
slow: 500 // formatting delay in ms
}
});Output:
đ [SmartTable] Finding row with filters: { Name: 'John' }
âšī¸ [SmartTable] Scanned 10 rows on page 1
đ [SmartTable] Checking row 1: Name="Alice" (Mismatch)
đ [SmartTable] Checking row 2: Name="John" (Match!)Common Issues & Fixes â
"Column not found" â
Cause: The header selector didn't match the table headers. Fix:
- Check the
headerSelectorconfig. - Use
table.getHeaders()to see what was actually detected.
typescript
console.log(await table.getHeaders());"Row not found" â
Cause: Data mismatch or strict matching. Fix:
- Disable
exactmatch:findRow({ Name: 'John' }, { exact: false }). - Inspect the cell text:
await table.getRows().then(r => r[0].toJSON()).
"Element is not attached" â
Cause: The table re-rendered (e.g. React/Vue update) and the cached Locators are stale. Fix: The library handles this automatically in 99% of cases. If you see this manually, try:
typescript
await table.revalidate();Visual Debugging â
Since SmartRow returns standard Playwright Locators, you can use Playwright's visual tools:
typescript
// Highlight the specific cell
await row.getCell('Status').highlight();
// Pause execution to inspect DOM
await page.pause();Checking Initialization State â
Unsure if the table understands your structure?
typescript
// Check if headers are mapped
if (table.isInitialized()) {
const headers = await table.getHeaders();
console.log('Mapped Columns:', headers);
}