Questions tagged locators
Choosing a locator that survives the next redesign.
17 questions
Example threads. These questions and answers were written by the SDODS team to document real problems and how to fix them. The people named are illustrative, not real users. Questions asked on this site are marked new.
How do you test a node-graph editor — blocks, edges and connection handles?
Half our product is a workflow builder: a canvas with about 190 block types, edges between them, and connection handles on each node. None of it is text or roles — the nodes…
asked by Nadia BelkacemHealing picked the wrong one of three matching elements and the test still passed
Product grid, several cards, each with an "Add" button. The context on our add-to-basket locator is: The primary broke after a class rename. The healer found three matching…
asked by Devon MarshCart got redesigned — re-record the flow from scratch, or patch the old spec?
The cart page was redesigned. Same flow, different markup. We have checkout.spec.ts from March and a feature that came out of it back then. Do I re-record from scratch or patch…
asked by Rasha HalabiIs XPath actually forbidden in a page object, or only discouraged?
Reviewer left "never XPath" on my proposal. The locator strategy page says CSS or XPath as a last resort inside a page object with a heal context, which reads like "allowed but…
Our nth-child selectors break every sprint and healing never rescues them
Inherited suite, roughly two hundred locators in this shape: Every time the results list gains a badge or a promo row, a chunk of them break, and they break with HEAL_FAILED…
asked by Tanvi BhattThe healer proposed a CSS locator when there is a perfectly good label — reject it?
Scenario broke, ran the healer, got a proposal. The patch swaps a page-object locator for a class chain: The input has a visible label reading "Promo code". So there is an…
asked by Anouk de VriesHEAL_FAILED: nothing scored above 0.6 and testId probed at 0.00
The context is: What I cannot work out is testid=0.00. It is the same test id the primary uses, so of course it found nothing — but then why probe it at all? And where does 0.42…
asked by Anouk de VriesWe renamed one button and 40 scenarios healed in the same run — now what?
Design renamed "Continue" to "Next" on the checkout stepper. Nothing failed. The nightly regression run is green and carries forty-one heal events, all with the same description,…
Recorded spec is all .btn_primary and nth-child — fix the locators before or after converting?
Recorded a checkout. The spec is mostly this: Each of those came back with a // sdods:fragile comment above it, and the CLI finished with I would rather not convert this into a…
Inherited 900 Cypress specs: what maps to what, and what happens to custom commands?
I have inherited a Cypress suite. Roughly 900 specs, data-cy attributes throughout, about 60 custom commands in cypress/support/commands.js, and a cypress/fixtures folder nobody…
testIdAttribute is data-test, so why does the heal suggestion say getByTestId?
Our app has used data-test since long before we adopted SDODS. I set it in the project file: Heal report suggests getByTestId('cart-badge') for a locator that healed. I pasted…
asked by Yusuf DemirCan I put an XPath in the css fallback list of a heal context?
Our app renders a summary table where the only stable thing about a row is its position relative to a header cell. The reviewer agent keeps flagging the selector, so I was going…
How do you assert on a row in a table without writing a CSS chain?
Orders table, and the scenario I want reads: What I have in the page object is this, which works until someone sorts the table or the row moves to page two: Is there a…
asked by Sunita KaleShould I commit the suggested locator from a heal log, or go and find out why?
Our log has been telling us this for a fortnight: I cannot tell whether "update the page object" means "paste this in" or "go and find out why". The suggestion is obviously…
asked by Sam OrbisonA header widget appears on six pages — one page object per page, or something else?
Our header carries the cart badge, the account menu and a search box, and it is on six pages. Right now the cart badge locator is copy-pasted into six page objects, which was…
asked by Nadia BelkacemHealing does nothing — I just get the normal Playwright timeout
We turned healing on for our checkout page object and the button still fails exactly the way it did before. No heal event, nothing in the log, just the Playwright timeout. The…
Coming from Selenium PageFactory — what replaces @FindBy and initElements?
We have a Java suite, maybe 300 tests, built the way everyone built them: a BasePage holding the driver and the waits, @FindBy(xpath = "//div[@class='cart']//button") fields, and…
asked by Dinuka Perera