From 823f4f57f26fd52aa9f9ce298e51675561f310e9 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Tue, 16 Aug 2022 11:02:15 -0700 Subject: [PATCH] fix(docs): make docs compile (#16588) --- docs/src/locators.md | 4 +- docs/src/testing-library-js.md | 2 +- packages/playwright-core/types/types.d.ts | 300 +++++++++++----------- 3 files changed, 157 insertions(+), 149 deletions(-) diff --git a/docs/src/locators.md b/docs/src/locators.md index 86764447f3..b94a6ef10e 100644 --- a/docs/src/locators.md +++ b/docs/src/locators.md @@ -70,7 +70,7 @@ await locator.ClickAsync(); ### Creating Locators -Use [`method: Page.locator`] method to create a locator. This method takes a selector that describes how to find an element in the page. Playwright supports many different selectors like [Text](./text-selector), [CSS](./#css-selector), [XPath](./#xpath-selectors) and many more. Learn more about available selectors and how to pick one in this [in-depth guide](./#selectors). +Use [`method: Page.locator`] method to create a locator. This method takes a selector that describes how to find an element in the page. Playwright supports many different selectors like [Text](#text-selector), [CSS](#css-selector), [XPath](#xpath-selectors) and many more. Learn more about available selectors and how to pick one in this [in-depth guide](#selectors). ```js // Find by text. @@ -189,7 +189,7 @@ await page.Locator("button").CountAsync(); ``` :::caution -Using [`method: Locator.first`], [`method: Locator.last`], and [`method: Locator.nth`] is discouraged since it disables the concept of strictness, and as your page changes, Playwright may click on an element you did not intend. It's better to make your locator more specific. Learn more below in [Filtering Locators](#filtering-locators) and the [selectors guide](./#selectors). +Using [`method: Locator.first`], [`method: Locator.last`], and [`method: Locator.nth`] is discouraged since it disables the concept of strictness, and as your page changes, Playwright may click on an element you did not intend. It's better to make your locator more specific. Learn more below in [Filtering Locators](#filtering-locators) and the [selectors guide](#selectors). ::: ### Lists diff --git a/docs/src/testing-library-js.md b/docs/src/testing-library-js.md index 56f8a2875d..646342b02c 100644 --- a/docs/src/testing-library-js.md +++ b/docs/src/testing-library-js.md @@ -153,6 +153,6 @@ Learn more about Playwright Test runner: - [Getting Started](./intro) - [Experimental Component Testing](./test-components) - [Locators](./api/class-locator) -- [Selectors](./selectors) +- [Selectors](./locators#selectors) - [Assertions](./test-assertions) - [Auto-waiting](./actionability) diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index c85c16b037..b32d30a6e4 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -258,7 +258,7 @@ export interface Page { * * Shortcut for main frame's * [frame.$(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-query-selector). - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ $(selector: K, options?: { strict: boolean }): Promise | null>; @@ -271,7 +271,7 @@ export interface Page { * * Shortcut for main frame's * [frame.$(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-query-selector). - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ $(selector: string, options?: { strict: boolean }): Promise | null>; @@ -283,7 +283,7 @@ export interface Page { * return value resolves to `[]`. * * Shortcut for main frame's [frame.$$(selector)](https://playwright.dev/docs/api/class-frame#frame-query-selector-all). - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. */ $$(selector: K): Promise[]>; /** @@ -293,7 +293,7 @@ export interface Page { * return value resolves to `[]`. * * Shortcut for main frame's [frame.$$(selector)](https://playwright.dev/docs/api/class-frame#frame-query-selector-all). - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. */ $$(selector: string): Promise[]>; @@ -322,7 +322,7 @@ export interface Page { * * Shortcut for main frame's * [frame.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-eval-on-selector). - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param pageFunction Function to be evaluated in the page context. * @param arg Optional argument to pass to `pageFunction`. * @param options @@ -353,7 +353,7 @@ export interface Page { * * Shortcut for main frame's * [frame.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-eval-on-selector). - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param pageFunction Function to be evaluated in the page context. * @param arg Optional argument to pass to `pageFunction`. * @param options @@ -384,7 +384,7 @@ export interface Page { * * Shortcut for main frame's * [frame.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-eval-on-selector). - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param pageFunction Function to be evaluated in the page context. * @param arg Optional argument to pass to `pageFunction`. * @param options @@ -415,7 +415,7 @@ export interface Page { * * Shortcut for main frame's * [frame.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-eval-on-selector). - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param pageFunction Function to be evaluated in the page context. * @param arg Optional argument to pass to `pageFunction`. * @param options @@ -440,7 +440,7 @@ export interface Page { * const divCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10); * ``` * - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param pageFunction Function to be evaluated in the page context. * @param arg Optional argument to pass to `pageFunction`. */ @@ -463,7 +463,7 @@ export interface Page { * const divCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10); * ``` * - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param pageFunction Function to be evaluated in the page context. * @param arg Optional argument to pass to `pageFunction`. */ @@ -486,7 +486,7 @@ export interface Page { * const divCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10); * ``` * - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param pageFunction Function to be evaluated in the page context. * @param arg Optional argument to pass to `pageFunction`. */ @@ -509,7 +509,7 @@ export interface Page { * const divCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10); * ``` * - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param pageFunction Function to be evaluated in the page context. * @param arg Optional argument to pass to `pageFunction`. */ @@ -616,7 +616,7 @@ export interface Page { * })(); * ``` * - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ waitForSelector(selector: K, options?: PageWaitForSelectorOptionsNotHidden): Promise>; @@ -648,7 +648,7 @@ export interface Page { * })(); * ``` * - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ waitForSelector(selector: string, options?: PageWaitForSelectorOptionsNotHidden): Promise>; @@ -680,7 +680,7 @@ export interface Page { * })(); * ``` * - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ waitForSelector(selector: K, options: PageWaitForSelectorOptions): Promise | null>; @@ -712,7 +712,7 @@ export interface Page { * })(); * ``` * - * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ waitForSelector(selector: string, options: PageWaitForSelectorOptions): Promise>; @@ -1850,7 +1850,7 @@ export interface Page { * zero timeout disables this. * * Shortcut for main frame's [frame.check(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-check). - * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ check(selector: string, options?: { @@ -1911,7 +1911,7 @@ export interface Page { * zero timeout disables this. * * Shortcut for main frame's [frame.click(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-click). - * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ click(selector: string, options?: { @@ -2032,7 +2032,7 @@ export interface Page { * * Shortcut for main frame's * [frame.dblclick(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-dblclick). - * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ dblclick(selector: string, options?: { @@ -2124,7 +2124,7 @@ export interface Page { * await page.dispatchEvent('#source', 'dragstart', { dataTransfer }); * ``` * - * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param type DOM event type: `"click"`, `"dragstart"`, etc. * @param eventInit Optional event-specific initialization properties. * @param options @@ -2146,8 +2146,8 @@ export interface Page { }): Promise; /** - * @param source A selector to search for an element to drag. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details. - * @param target A selector to search for an element to drop onto. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param source A selector to search for an element to drag. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. + * @param target A selector to search for an element to drop onto. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param options */ dragAndDrop(source: string, target: string, options?: { @@ -2324,7 +2324,7 @@ export interface Page { * * Shortcut for main frame's * [frame.fill(selector, value[, options])](https://playwright.dev/docs/api/class-frame#frame-fill). - * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details. + * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/locators#selectors) for more details. * @param value Value to fill for the ``, `