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

Virtualized list practice

Practice a virtualized list: 1,000 orders, but only the twenty or so rows on screen exist in the DOM. Rosa Quinn’s order, ORD-742, is not on the page until you scroll to it, and on v2 the list runs the other way. Open the admin orders table

1,000-row virtualized listScroll to ORD-742 (Rosa Quinn). Rows outside the view are removed, not hidden.

Built well

ORD-1Ada ParkPaid
ORD-2Bo ChenRefunded
ORD-3Cal DiazPending
ORD-4Dee EvansShipped
ORD-5Eli FoxPaid
ORD-6Fay GoldRefunded
ORD-7Gus HalePending
ORD-8Ivy ItoShipped
ORD-9Jon KerrPaid
ORD-10Kai LundRefunded
ORD-11Lia MossPending
ORD-12Max NoriShipped
ORD-13Ada ParkPaid
ORD-14Bo ChenRefunded

Built to break

ORD-1Ada ParkPaid
ORD-2Bo ChenRefunded
ORD-3Cal DiazPending
ORD-4Dee EvansShipped
ORD-5Eli FoxPaid
ORD-6Fay GoldRefunded
ORD-7Gus HalePending
ORD-8Ivy ItoShipped
ORD-9Jon KerrPaid
ORD-10Kai LundRefunded
ORD-11Lia MossPending
ORD-12Max NoriShipped
ORD-13Ada ParkPaid
ORD-14Bo ChenRefunded

Tasks: write a locator, get a grade

1Find Rosa Quinn's order (ORD-742) in the 1,000-order list by its customer, not its position. It is not in the DOM until you scroll the list to it.Not rendered yet
2Find the list itself: the element a test scrolls to bring rows into view.Scroll container
How to locate Virtualized lists

The row you want does not exist yet

Virtualized lists (react-window, TanStack Virtual, AG Grid, most data grids) render only the rows in view plus a few spare. Scroll, and rows leaving the view are removed while new ones are created. A locator for ORD-742 matches nothing on page load, not because it is wrong but because the row has not been built.

Row position means nothing here. The fifth row element in the DOM is whatever happens to be fifth in the current window, and on v2 the list is reversed, so ORD-742 sits near row 259 instead of row 742. Absolute positions from transform or top change with every scroll.

Recycling makes it worse: some libraries reuse row elements for new data, so a reference you held to a row can quietly start pointing at a different order after a scroll.

What a stable locator looks like

Locate by content, then scroll until it exists. Find the grid by its test id or name, scroll it a step at a time, and stop when the row with the order id appears. aria-rowindex tells you where a row sits in the full list, and aria-rowcount how many rows there are, so you can jump close before stepping. Rows here also carry data-customer, an attribute the app owns that names the record without a generated-looking number. Never keep a row reference across a scroll; locate it again.

const list = page.getByTestId('order-list');
const row = list.locator('[data-customer="Rosa Quinn"]');

// Scroll the list until the row is rendered, then use it
while (!(await row.count())) {
  await list.evaluate((el) => el.scrollBy(0, el.clientHeight));
}
await expect(row).toContainText('ORD-742');

In a real workflow

The admin orders screen has a 500-row virtualized archive under the orders table. Sign in to the admin and bring ORD-1450 into view without counting rows.

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

Add to Chrome