On this page
Page objects, and what replaces them
The page object model exists to keep selectors out of your tests, in a class you can fix in one place when the interface changes. xtest has no such layer to build: tests are sentences, the test agent finds elements as it goes, and the steps it worked out are saved against the test case. Three habits do the job a page object was doing.
1. Put the stable name in the markup, not in a class
A test id or a clear accessible name is the one thing that survives a redesign, and it helps the AI, a screen reader and a pasted Playwright script equally.
<!-- The AI finds this every time, however the page is restyled. -->
<button data-testid="checkout-pay" aria-label="Pay now">Pay now</button>2. Let the saved steps be the shared layer
Once the AI has worked a case out, its steps are stored for that case, per kind of device, and replayed on every later run at no AI cost unless a step needs the AI. When the interface moves, the AI repairs the step that broke and saves the repair. That is the maintenance a page object used to ask of you, done where the change was noticed.
3. Write shared knowledge down once
Facts every test needs, such as which account is safe to buy with, or that the cookie banner must be dismissed first, belong in the notes the AI reads for that site rather than repeated in twenty test cases. They are short on purpose: 300 characters each.
If you paste Playwright that uses page objects
It will not be recognised. A pasted script is read, never executed, and the reader matches literal calls such as page.getByTestId('pay') and page.fill(…). A method on a class of yours is not one of those, so it is listed back to you as a line that was not run. Flatten the flow you want to replay into direct calls, or describe it in plain English and let the AI do it.