Skip to content

← All questions

Recorded spec is all .btn_primary and nth-child — fix the locators before or after converting?

Asked 11,930 views3 answers

Recorded a checkout. The spec is mostly this:

ts
await page.locator('.inventory_item:nth-child(3) > .pricebar > .btn_primary').click();
await page.locator('#checkout').click();

Each of those came back with a // sdods:fragile comment above it, and the CLI finished with

text
⚠ 12 CSS/XPath locator(s) marked // sdods:fragile — prefer role/label/test-id locators.

I would rather not convert this into a feature and inherit twelve selectors that break next sprint. What is the right order of operations?

asked by Nikhil Sane487 ·

3 answers

Have the same question?

Ask it with the command you ran and the output you got, and it will be answered here.

Ask a question

Related