Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: expand "Strictness" examples (#8520)
Michael Rienstra348277d09c2f
diff --git a/docs/src/api/class-locator.md b/docs/src/api/class-locator.mdindex e6c94970fa..1ac7e78c07 100644--- a/docs/src/api/class-locator.md+++ b/docs/src/api/class-locator.md@@ -107,6 +107,9 @@ await page.locator('button').click();// Works because we explicitly tell locator to pick the first element:await page.locator('button').first().click();++// Works because count knows what to do with multiple matches:+await page.locator('button').count();``````python async@@ -115,6 +118,9 @@ await page.locator('button').click()# Works because we explicitly tell locator to pick the first element:await page.locator('button').first.click()++# Works because count knows what to do with multiple matches:+await page.locator('button').count()``````python sync@@ -123,21 +129,31 @@ page.locator('button').click()# Works because we explicitly tell locator to pick the first element:page.locator('button').first.click()++# Works because count knows what to do with multiple matches:+page.locator('button').count()``````java// Throws if there are several buttons in DOM:page.locator("button").click();-// Works because you explicitly tell locator to pick the first element:+// Works because we explicitly tell locator to pick the first element:page.locator("button").first().click();++// Works because count knows what to do with multiple matches:+page.locator("button").count();``````csharp// Throws if there are several buttons in DOM:await page.Locator("button").ClickAsync();-// Works because you explicitly tell locator to pick the first element:++// Works because we explicitly tell locator to pick the first element:await page.Locator("button").First.ClickAsync();++// Works because Count knows what to do with multiple matches:+await page.Locator("button").CountAsync();```## async method: Locator.allInnerTextsdiff --git a/types/types.d.ts b/types/types.d.tsindex 5b1eacf81e..8f1de02218 100644--- a/types/types.d.ts+++ b/types/types.d.ts@@ -8345,6 +8345,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {** // Works because we explicitly tell locator to pick the first element:* await page.locator('button').first().click();+ *+ * // Works because count knows what to do with multiple matches:+ * await page.locator('button').count();* ```**/