Skip to content

← All questions

Our nth-child selectors break every sprint and healing never rescues them

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.

Inherited suite, roughly two hundred locators in this shape:

ts
readonly price = this.heal.locator(
  this.page.locator('.results > div:nth-child(3) > span:nth-child(2)'),
  { description: 'first result price', css: ['.results div:nth-child(3) span'] },
);

Every time the results list gains a badge or a promo row, a chunk of them break, and they break with HEAL_FAILED rather than healing. The contexts are declared, so I expected at least some recovery. What am I supposed to do with two hundred of these?

3 answers

Know the answer?

Wrap commands and output in triple backticks and they will render as a code block.

Checking whether you’re signed in…

Have a different question? Ask it.

Related