diff --git a/docs/src/api/class-locator.md b/docs/src/api/class-locator.md index f2f2acc619..fee96a8cde 100644 --- a/docs/src/api/class-locator.md +++ b/docs/src/api/class-locator.md @@ -13,6 +13,8 @@ a way to find element(s) on the page at any moment. Locator can be created with When locator points to a list of elements, returns array of locators, pointing to respective elements. +Note that [`method: Locator.all`] does not wait for elements to match the locator, and instead immediately returns whatever is present in the page. To avoid flakiness when elements are loaded dynamically, wait for the loading to finish before calling [`method: Locator.all`]. + **Usage** ```js diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index 906225bd7b..d73ef46ad0 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -10125,6 +10125,11 @@ export interface Locator { /** * When locator points to a list of elements, returns array of locators, pointing to respective elements. * + * Note that [locator.all()](https://playwright.dev/docs/api/class-locator#locator-all) does not wait for elements to + * match the locator, and instead immediately returns whatever is present in the page. To avoid flakiness when + * elements are loaded dynamically, wait for the loading to finish before calling + * [locator.all()](https://playwright.dev/docs/api/class-locator#locator-all). + * * **Usage** * * ```js