QA PRACTICE•STRICT

Locator Practice HubTopics / Strict mode and actionability

Lesson 9 / 20 · Intermediate

Strict mode and actionability

Diagnose ambiguous matches before an action fails.

12 min

Not completed

Concept

Playwright strict mode tekil hedef ister. Actionability; visible, enabled, stable ve receives-events kontrollerini kapsar. Çok eşleşme, overlay veya animasyon nedeniyle tıklama başarısız olabilir.

Prerequisites: Role and accessible name

Live demo

Try the locator

Scoped to lesson demo

Try the locator against the live demo.

Good

Strict mode hatasını scope, role/name veya filter ile çöz.

Avoid

`.first()` ekleyerek yanlış hedefi sessizce seçme.

Why

Testin gerçekten doğru kontrolü kullandığını garanti edersin.

Real-world trap

Bir locator’ın eşleşmesi, action’ın başarılı olacağı anlamına gelmez.

Framework comparison

Playwright

page.locator("[data-testid='strict-demo'] button:nth-of-type(2)")

Selenium

driver.findElement(By.cssSelector("[data-testid='strict-demo'] button:nth-of-type(2)"))

Cypress

cy.get("[data-testid='strict-demo'] button:nth-of-type(2)")

Mini quiz

Strict mode çok eşleşmede ne söyler?