Switch to v2 to see which selectors break.
Add to Chrome

Dynamic web table practice

Practice reading, sorting and editing tables, plus a virtualized table whose rows only exist while they are on screen. Open the admin orders table

Sortable, editable tableSort by any column. Edit a customer name with the pencil.

Built well

Recent orders
ORD-1001Ada ParkPaid$19.50
ORD-1002Bo ChenRefunded$56.50
ORD-1003Cal DiazPending$93.50
ORD-1004Dee EvansShipped$130.50
ORD-1005Eli FoxPaid$167.50
ORD-1006Fay GoldRefunded$204.50
ORD-1007Gus HalePending$241.50
ORD-1008Ivy ItoShipped$278.50
ORD-1009Jon KerrPaid$315.50
ORD-1010Kai LundRefunded$352.50
ORD-1011Lia MossPending$389.50
ORD-1012Max NoriShipped$26.50

Built to break

Order
Customer
Status
Total
ORD-1001
Ada Park
✎
Paid
$19.50
ORD-1002
Bo Chen
✎
Refunded
$56.50
ORD-1003
Cal Diaz
✎
Pending
$93.50
ORD-1004
Dee Evans
✎
Shipped
$130.50
ORD-1005
Eli Fox
✎
Paid
$167.50
ORD-1006
Fay Gold
✎
Refunded
$204.50
ORD-1007
Gus Hale
✎
Pending
$241.50
ORD-1008
Ivy Ito
✎
Shipped
$278.50
ORD-1009
Jon Kerr
✎
Paid
$315.50
ORD-1010
Kai Lund
✎
Refunded
$352.50
ORD-1011
Lia Moss
✎
Pending
$389.50
ORD-1012
Max Nori
✎
Shipped
$26.50

Virtualized table500 orders, but only the rows in view are in the DOM.

Built well

ORD-1001Ada ParkPaid
ORD-1002Bo ChenRefunded
ORD-1003Cal DiazPending
ORD-1004Dee EvansShipped
ORD-1005Eli FoxPaid
ORD-1006Fay GoldRefunded
ORD-1007Gus HalePending
ORD-1008Ivy ItoShipped
ORD-1009Jon KerrPaid
ORD-1010Kai LundRefunded
ORD-1011Lia MossPending
ORD-1012Max NoriShipped
ORD-1013Ada ParkPaid
ORD-1014Bo ChenRefunded

Built to break

ORD-1001Ada ParkPaid
ORD-1002Bo ChenRefunded
ORD-1003Cal DiazPending
ORD-1004Dee EvansShipped
ORD-1005Eli FoxPaid
ORD-1006Fay GoldRefunded
ORD-1007Gus HalePending
ORD-1008Ivy ItoShipped
ORD-1009Jon KerrPaid
ORD-1010Kai LundRefunded
ORD-1011Lia MossPending
ORD-1012Max NoriShipped
ORD-1013Ada ParkPaid
ORD-1014Bo ChenRefunded

Paginated tableFind INV-1010: it is not on the first page.

Built well

Invoices
OrderCustomerStatusTotal
INV-1001Ada ParkPaid$19.50
INV-1002Bo ChenRefunded$56.50
INV-1003Cal DiazPending$93.50
INV-1004Dee EvansShipped$130.50

Built to break

Order
Customer
Status
Total
INV-1001
Ada Park
Paid
$19.50
INV-1002
Bo Chen
Refunded
$56.50
INV-1003
Cal Diaz
Pending
$93.50
INV-1004
Dee Evans
Shipped
$130.50
‹
1/3
›

Table of duplicate valuesFind the run on Firefox in Austin. Most cells repeat.

Built well

RunOSBrowserCityCountry
DUP-1WindowsChromePuneIndia
DUP-2WindowsFirefoxPuneIndia
DUP-3macOSChromePuneIndia
DUP-4WindowsChromeAustinUSA
DUP-5LinuxFirefoxPuneIndia
DUP-6WindowsChromePuneIndia
DUP-7macOSSafariAustinUSA
DUP-8WindowsFirefoxAustinUSA

Built to break

Windows
Chrome
Pune
India
Windows
Firefox
Pune
India
macOS
Chrome
Pune
India
Windows
Chrome
Austin
USA
Linux
Firefox
Pune
India
Windows
Chrome
Pune
India
macOS
Safari
Austin
USA
Windows
Firefox
Austin
USA

Tasks: write a locator, get a grade

1Click Edit on Bo Chen's customer name in Recent orders.Rows reorder
2Find the Total cell of order ORD-1003 in Recent orders: pick the row by its order number and the cell by its column (cells carry data-label), not by index.No index
3Find every Status cell that says Paid in Recent orders.Many matches
How to locate Web tables

Tables tempt you to count

The quickest locator for a cell is a position: the third row, the second cell. It works until the order changes, and table order changes all the time. A user sorts, a new record arrives, a filter is applied, or a release changes the default sort. On v2 this page reverses every table, so a positional locator that passed on v1 now reads a different order.

The fix is to find the record first and the cell second. Every row here carries a test id with its order number, and its accessible name includes that number too. Find the row by what identifies the record, then look inside that row for the cell, button or text you need.

Div grids look like tables but are not. They have no table roles, so getByRole('row') finds nothing and table-aware XPath such as //tr/td[2] matches nothing. The fragile table on this page is a div grid with generated class names, which leaves position and visible text as the only handles.

Paginated tables hide most of their rows. A test that expects a record on the first page breaks when sorting or new data pushes it to the second. Filter or sort first, or page until the record appears.

Virtualized tables render only what is on screen. Rows scrolled out of view are not hidden; they do not exist in the DOM. A test has to scroll the container until the row is rendered, and aria-rowindex tells it where it is in the full list.

What a stable locator looks like

Scope to the table, find the row by its record id or test id, then work inside that row. For sorting, check aria-sort on the column header rather than reading the values back. For virtualized tables, scroll the container and wait for the row to appear.

// Find the record, not the position
const row = page.getByTestId('orders-table').getByRole('row', { name: /ORD-1003/ });
await row.getByRole('button', { name: 'Edit customer for ORD-1003' }).click();
await page.getByLabel('Customer for ORD-1003').fill('Zed Young');
await page.getByRole('button', { name: 'Save' }).click();
await expect(row).toContainText('Zed Young');

await page.getByRole('button', { name: 'Total' }).click();
await expect(page.getByRole('columnheader', { name: /Total/ }))
  .toHaveAttribute('aria-sort', 'ascending');

// Virtualized: scroll until the row exists
await page.getByTestId('virtual-table').evaluate((el) => { el.scrollTop = 40 * 300; });
await expect(page.getByTestId('vrow-ORD-1301')).toBeVisible();

In a real workflow

The admin’s orders screen has a sortable, paginated table where you change an order’s status inline, and a 500-row archive that loads as you scroll. Sign in, sort by total, edit a status, and find an order deep in the archive.

COR Lens generates locators for shadow DOM, iframes and tables, and grades each one. Click the web tables above with it and compare its pick with yours.

Add to Chrome