Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: mention locator.nth is zero based (#12750)

Max Schmitt01beb6310a93
diff --git a/docs/src/api/class-framelocator.md b/docs/src/api/class-framelocator.md
index 9e57a0be87..7db64f85f3 100644
--- a/docs/src/api/class-framelocator.md
+++ b/docs/src/api/class-framelocator.md
@@ -128,7 +128,7 @@ The method finds an element matching the specified selector in the FrameLocator'
## method: FrameLocator.nth
- returns: <[FrameLocator]>
-Returns locator to the n-th matching frame.
+Returns locator to the n-th matching frame. It's zero based, `nth(0)` selects the first frame.
### param: FrameLocator.nth.index
- `index` <[int]>
diff --git a/docs/src/api/class-locator.md b/docs/src/api/class-locator.md
index 82257fa0cc..649e7e8ada 100644
--- a/docs/src/api/class-locator.md
+++ b/docs/src/api/class-locator.md
@@ -550,7 +550,7 @@ The method finds an element matching the specified selector in the `Locator`'s s
## method: Locator.nth
- returns: <[Locator]>
-Returns locator to the n-th matching element.
+Returns locator to the n-th matching element. It's zero based, `nth(0)` selects the first element.
### param: Locator.nth.index
- `index` <[int]>
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index 9c4885abe8..28bba91bdc 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -9403,7 +9403,7 @@ export interface Locator {
}): Locator;
/**
- * Returns locator to the n-th matching element.
+ * Returns locator to the n-th matching element. It's zero based, `nth(0)` selects the first element.
* @param index
*/
nth(index: number): Locator;
@@ -13846,7 +13846,7 @@ export interface FrameLocator {
}): Locator;
/**
- * Returns locator to the n-th matching frame.
+ * Returns locator to the n-th matching frame. It's zero based, `nth(0)` selects the first frame.
* @param index
*/
nth(index: number): FrameLocator;