diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index eacc1393e349c..6702fc9fb2884 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -29,9 +29,10 @@ type ElementHandleWaitForSelectorOptionsNotHidden = ElementHandleWaitForSelector }; /** - * Page provides methods to interact with a single tab in a {@link Browser}, or an - * [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. One {@link - * Browser} instance might have multiple {@link Page} instances. + * Page provides methods to interact with a single tab in a [Browser](https://playwright.dev/docs/api/class-browser), + * or an [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium. One + * [Browser](https://playwright.dev/docs/api/class-browser) instance might have multiple + * [Page](https://playwright.dev/docs/api/class-page) instances. * * This example creates a page, navigates it to a URL, and then saves a screenshot: * @@ -72,7 +73,8 @@ type ElementHandleWaitForSelectorOptionsNotHidden = ElementHandleWaitForSelector */ export interface Page { /** - * Returns the value of the `pageFunction` invocation. + * Returns the value of the + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-option-expression) invocation. * * If the function passed to the * [page.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate) returns a [Promise], @@ -88,7 +90,7 @@ export interface Page { * * **Usage** * - * Passing argument to `pageFunction`: + * Passing argument to [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-option-expression): * * ```js * const result = await page.evaluate(([x, y]) => { @@ -105,7 +107,7 @@ export interface Page { * console.log(await page.evaluate(`1 + ${x}`)); // prints "11" * ``` * - * {@link ElementHandle} instances can be passed as an argument to the + * [ElementHandle](https://playwright.dev/docs/api/class-elementhandle) instances can be passed as an argument to the * [page.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate): * * ```js @@ -117,11 +119,13 @@ export interface Page { * ``` * * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-option-expression). */ evaluate(pageFunction: PageFunction, arg: Arg): Promise; /** - * Returns the value of the `pageFunction` invocation. + * Returns the value of the + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-option-expression) invocation. * * If the function passed to the * [page.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate) returns a [Promise], @@ -137,7 +141,7 @@ export interface Page { * * **Usage** * - * Passing argument to `pageFunction`: + * Passing argument to [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-option-expression): * * ```js * const result = await page.evaluate(([x, y]) => { @@ -154,7 +158,7 @@ export interface Page { * console.log(await page.evaluate(`1 + ${x}`)); // prints "11" * ``` * - * {@link ElementHandle} instances can be passed as an argument to the + * [ElementHandle](https://playwright.dev/docs/api/class-elementhandle) instances can be passed as an argument to the * [page.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate): * * ```js @@ -166,18 +170,21 @@ export interface Page { * ``` * * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-option-expression). */ evaluate(pageFunction: PageFunction, arg?: any): Promise; /** - * Returns the value of the `pageFunction` invocation as a {@link JSHandle}. + * Returns the value of the + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-handle-option-expression) invocation as a + * [JSHandle](https://playwright.dev/docs/api/class-jshandle). * * The only difference between * [page.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate) and * [page.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate-handle) is that * [page.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate-handle) returns - * {@link JSHandle}. + * [JSHandle](https://playwright.dev/docs/api/class-jshandle). * * If the function passed to the * [page.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate-handle) returns @@ -198,7 +205,7 @@ export interface Page { * const aHandle = await page.evaluateHandle('document'); // Handle for the 'document' * ``` * - * {@link JSHandle} instances can be passed as an argument to the + * [JSHandle](https://playwright.dev/docs/api/class-jshandle) instances can be passed as an argument to the * [page.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate-handle): * * ```js @@ -209,17 +216,20 @@ export interface Page { * ``` * * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-handle-option-expression). */ evaluateHandle(pageFunction: PageFunction, arg: Arg): Promise>; /** - * Returns the value of the `pageFunction` invocation as a {@link JSHandle}. + * Returns the value of the + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-handle-option-expression) invocation as a + * [JSHandle](https://playwright.dev/docs/api/class-jshandle). * * The only difference between * [page.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate) and * [page.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate-handle) is that * [page.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate-handle) returns - * {@link JSHandle}. + * [JSHandle](https://playwright.dev/docs/api/class-jshandle). * * If the function passed to the * [page.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate-handle) returns @@ -240,7 +250,7 @@ export interface Page { * const aHandle = await page.evaluateHandle('document'); // Handle for the 'document' * ``` * - * {@link JSHandle} instances can be passed as an argument to the + * [JSHandle](https://playwright.dev/docs/api/class-jshandle) instances can be passed as an argument to the * [page.evaluateHandle(pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-evaluate-handle): * * ```js @@ -251,7 +261,8 @@ export interface Page { * ``` * * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-handle-option-expression). */ evaluateHandle(pageFunction: PageFunction, arg?: any): Promise>; @@ -289,7 +300,9 @@ export interface Page { * and [page.addInitScript(script[, arg])](https://playwright.dev/docs/api/class-page#page-add-init-script) is not * defined. * @param script Script to be evaluated in the page. - * @param arg Optional argument to pass to `script` (only supported when passing a function). + * @param arg Optional argument to pass to + * [`script`](https://playwright.dev/docs/api/class-page#page-add-init-script-option-script) (only supported when + * passing a function). */ addInitScript(script: PageFunction | { path?: string, content?: string }, arg?: Arg): Promise; @@ -339,12 +352,15 @@ export interface Page { * **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. * Use * [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate), - * other {@link Locator} helper methods or web-first assertions instead. + * other [Locator](https://playwright.dev/docs/api/class-locator) helper methods or web-first assertions instead. * * The method finds an element matching the specified selector within the page and passes it as a first argument to - * `pageFunction`. If no elements match the selector, the method throws an error. Returns the value of `pageFunction`. + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). If no + * elements match the selector, the method throws an error. Returns the value of + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). * - * If `pageFunction` returns a [Promise], then + * If [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression) returns a + * [Promise], then * [page.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-page#page-eval-on-selector) * would wait for the promise to resolve and return its value. * @@ -360,7 +376,8 @@ export interface Page { * * @param selector A selector to query for. * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). * @param options */ $eval(selector: K, pageFunction: PageFunctionOn, arg: Arg): Promise; @@ -368,12 +385,15 @@ export interface Page { * **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. * Use * [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate), - * other {@link Locator} helper methods or web-first assertions instead. + * other [Locator](https://playwright.dev/docs/api/class-locator) helper methods or web-first assertions instead. * * The method finds an element matching the specified selector within the page and passes it as a first argument to - * `pageFunction`. If no elements match the selector, the method throws an error. Returns the value of `pageFunction`. + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). If no + * elements match the selector, the method throws an error. Returns the value of + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). * - * If `pageFunction` returns a [Promise], then + * If [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression) returns a + * [Promise], then * [page.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-page#page-eval-on-selector) * would wait for the promise to resolve and return its value. * @@ -389,7 +409,8 @@ export interface Page { * * @param selector A selector to query for. * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). * @param options */ $eval(selector: string, pageFunction: PageFunctionOn, arg: Arg): Promise; @@ -397,12 +418,15 @@ export interface Page { * **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. * Use * [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate), - * other {@link Locator} helper methods or web-first assertions instead. + * other [Locator](https://playwright.dev/docs/api/class-locator) helper methods or web-first assertions instead. * * The method finds an element matching the specified selector within the page and passes it as a first argument to - * `pageFunction`. If no elements match the selector, the method throws an error. Returns the value of `pageFunction`. + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). If no + * elements match the selector, the method throws an error. Returns the value of + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). * - * If `pageFunction` returns a [Promise], then + * If [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression) returns a + * [Promise], then * [page.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-page#page-eval-on-selector) * would wait for the promise to resolve and return its value. * @@ -418,7 +442,8 @@ export interface Page { * * @param selector A selector to query for. * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). * @param options */ $eval(selector: K, pageFunction: PageFunctionOn, arg?: any): Promise; @@ -426,12 +451,15 @@ export interface Page { * **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests. * Use * [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate), - * other {@link Locator} helper methods or web-first assertions instead. + * other [Locator](https://playwright.dev/docs/api/class-locator) helper methods or web-first assertions instead. * * The method finds an element matching the specified selector within the page and passes it as a first argument to - * `pageFunction`. If no elements match the selector, the method throws an error. Returns the value of `pageFunction`. + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). If no + * elements match the selector, the method throws an error. Returns the value of + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). * - * If `pageFunction` returns a [Promise], then + * If [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression) returns a + * [Promise], then * [page.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-page#page-eval-on-selector) * would wait for the promise to resolve and return its value. * @@ -447,7 +475,8 @@ export interface Page { * * @param selector A selector to query for. * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-option-expression). * @param options */ $eval(selector: string, pageFunction: PageFunctionOn, arg?: any): Promise; @@ -455,12 +484,18 @@ export interface Page { /** * **NOTE** In most cases, * [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all), - * other {@link Locator} helper methods and web-first assertions do a better job. + * other [Locator](https://playwright.dev/docs/api/class-locator) helper methods and web-first assertions do a better + * job. * * The method finds all elements matching the specified selector within the page and passes an array of matched - * elements as a first argument to `pageFunction`. Returns the result of `pageFunction` invocation. + * elements as a first argument to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression). Returns + * the result of + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression) + * invocation. * - * If `pageFunction` returns a [Promise], then + * If [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression) returns + * a [Promise], then * [page.$$eval(selector, pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all) * would wait for the promise to resolve and return its value. * @@ -472,18 +507,25 @@ export interface Page { * * @param selector A selector to query for. * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression). */ $$eval(selector: K, pageFunction: PageFunctionOn, arg: Arg): Promise; /** * **NOTE** In most cases, * [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all), - * other {@link Locator} helper methods and web-first assertions do a better job. + * other [Locator](https://playwright.dev/docs/api/class-locator) helper methods and web-first assertions do a better + * job. * * The method finds all elements matching the specified selector within the page and passes an array of matched - * elements as a first argument to `pageFunction`. Returns the result of `pageFunction` invocation. + * elements as a first argument to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression). Returns + * the result of + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression) + * invocation. * - * If `pageFunction` returns a [Promise], then + * If [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression) returns + * a [Promise], then * [page.$$eval(selector, pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all) * would wait for the promise to resolve and return its value. * @@ -495,18 +537,25 @@ export interface Page { * * @param selector A selector to query for. * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression). */ $$eval(selector: string, pageFunction: PageFunctionOn, arg: Arg): Promise; /** * **NOTE** In most cases, * [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all), - * other {@link Locator} helper methods and web-first assertions do a better job. + * other [Locator](https://playwright.dev/docs/api/class-locator) helper methods and web-first assertions do a better + * job. * * The method finds all elements matching the specified selector within the page and passes an array of matched - * elements as a first argument to `pageFunction`. Returns the result of `pageFunction` invocation. + * elements as a first argument to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression). Returns + * the result of + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression) + * invocation. * - * If `pageFunction` returns a [Promise], then + * If [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression) returns + * a [Promise], then * [page.$$eval(selector, pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all) * would wait for the promise to resolve and return its value. * @@ -518,18 +567,25 @@ export interface Page { * * @param selector A selector to query for. * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression). */ $$eval(selector: K, pageFunction: PageFunctionOn, arg?: any): Promise; /** * **NOTE** In most cases, * [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all), - * other {@link Locator} helper methods and web-first assertions do a better job. + * other [Locator](https://playwright.dev/docs/api/class-locator) helper methods and web-first assertions do a better + * job. * * The method finds all elements matching the specified selector within the page and passes an array of matched - * elements as a first argument to `pageFunction`. Returns the result of `pageFunction` invocation. + * elements as a first argument to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression). Returns + * the result of + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression) + * invocation. * - * If `pageFunction` returns a [Promise], then + * If [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression) returns + * a [Promise], then * [page.$$eval(selector, pageFunction[, arg])](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all) * would wait for the promise to resolve and return its value. * @@ -541,12 +597,15 @@ export interface Page { * * @param selector A selector to query for. * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-eval-on-selector-all-option-expression). */ $$eval(selector: string, pageFunction: PageFunctionOn, arg?: any): Promise; /** - * Returns when the `pageFunction` returns a truthy value. It resolves to a JSHandle of the truthy value. + * Returns when the + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-wait-for-function-option-expression) returns a + * truthy value. It resolves to a JSHandle of the truthy value. * * **Usage** * @@ -577,12 +636,15 @@ export interface Page { * ``` * * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-wait-for-function-option-expression). * @param options */ waitForFunction(pageFunction: PageFunction, arg: Arg, options?: PageWaitForFunctionOptions): Promise>; /** - * Returns when the `pageFunction` returns a truthy value. It resolves to a JSHandle of the truthy value. + * Returns when the + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-wait-for-function-option-expression) returns a + * truthy value. It resolves to a JSHandle of the truthy value. * * **Usage** * @@ -613,7 +675,8 @@ export interface Page { * ``` * * @param pageFunction Function to be evaluated in the page context. - * @param arg Optional argument to pass to `pageFunction`. + * @param arg Optional argument to pass to + * [`pageFunction`](https://playwright.dev/docs/api/class-page#page-wait-for-function-option-expression). * @param options */ waitForFunction(pageFunction: PageFunction, arg?: any, options?: PageWaitForFunctionOptions): Promise>; @@ -623,15 +686,21 @@ export interface Page { * [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead. Read more * about [locators](https://playwright.dev/docs/locators). * - * Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or - * `detached`. + * Returns when element specified by selector satisfies + * [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option. Returns `null` if + * waiting for `hidden` or `detached`. * - * **NOTE** Playwright automatically waits for element to be ready before performing an action. Using {@link Locator} - * objects and web-first assertions makes the code wait-for-selector-free. + * **NOTE** Playwright automatically waits for element to be ready before performing an action. Using + * [Locator](https://playwright.dev/docs/api/class-locator) objects and web-first assertions makes the code + * wait-for-selector-free. * - * Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If - * at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. - * If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw. + * Wait for the [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) to + * satisfy [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option (either + * appear/disappear from dom, or become visible/hidden). If at the moment of calling the method + * [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) already satisfies + * the condition, the method will return immediately. If the selector doesn't satisfy the condition for the + * [`timeout`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-timeout) milliseconds, the + * function will throw. * * **Usage** * @@ -661,15 +730,21 @@ export interface Page { * [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead. Read more * about [locators](https://playwright.dev/docs/locators). * - * Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or - * `detached`. + * Returns when element specified by selector satisfies + * [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option. Returns `null` if + * waiting for `hidden` or `detached`. * - * **NOTE** Playwright automatically waits for element to be ready before performing an action. Using {@link Locator} - * objects and web-first assertions makes the code wait-for-selector-free. + * **NOTE** Playwright automatically waits for element to be ready before performing an action. Using + * [Locator](https://playwright.dev/docs/api/class-locator) objects and web-first assertions makes the code + * wait-for-selector-free. * - * Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If - * at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. - * If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw. + * Wait for the [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) to + * satisfy [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option (either + * appear/disappear from dom, or become visible/hidden). If at the moment of calling the method + * [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) already satisfies + * the condition, the method will return immediately. If the selector doesn't satisfy the condition for the + * [`timeout`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-timeout) milliseconds, the + * function will throw. * * **Usage** * @@ -699,15 +774,21 @@ export interface Page { * [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead. Read more * about [locators](https://playwright.dev/docs/locators). * - * Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or - * `detached`. + * Returns when element specified by selector satisfies + * [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option. Returns `null` if + * waiting for `hidden` or `detached`. * - * **NOTE** Playwright automatically waits for element to be ready before performing an action. Using {@link Locator} - * objects and web-first assertions makes the code wait-for-selector-free. + * **NOTE** Playwright automatically waits for element to be ready before performing an action. Using + * [Locator](https://playwright.dev/docs/api/class-locator) objects and web-first assertions makes the code + * wait-for-selector-free. * - * Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If - * at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. - * If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw. + * Wait for the [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) to + * satisfy [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option (either + * appear/disappear from dom, or become visible/hidden). If at the moment of calling the method + * [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) already satisfies + * the condition, the method will return immediately. If the selector doesn't satisfy the condition for the + * [`timeout`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-timeout) milliseconds, the + * function will throw. * * **Usage** * @@ -737,15 +818,21 @@ export interface Page { * [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead. Read more * about [locators](https://playwright.dev/docs/locators). * - * Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or - * `detached`. + * Returns when element specified by selector satisfies + * [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option. Returns `null` if + * waiting for `hidden` or `detached`. * - * **NOTE** Playwright automatically waits for element to be ready before performing an action. Using {@link Locator} - * objects and web-first assertions makes the code wait-for-selector-free. + * **NOTE** Playwright automatically waits for element to be ready before performing an action. Using + * [Locator](https://playwright.dev/docs/api/class-locator) objects and web-first assertions makes the code + * wait-for-selector-free. * - * Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If - * at the moment of calling the method `selector` already satisfies the condition, the method will return immediately. - * If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw. + * Wait for the [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) to + * satisfy [`state`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-state) option (either + * appear/disappear from dom, or become visible/hidden). If at the moment of calling the method + * [`selector`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-selector) already satisfies + * the condition, the method will return immediately. If the selector doesn't satisfy the condition for the + * [`timeout`](https://playwright.dev/docs/api/class-page#page-wait-for-selector-option-timeout) milliseconds, the + * function will throw. * * **Usage** * @@ -772,12 +859,18 @@ export interface Page { waitForSelector(selector: string, options: PageWaitForSelectorOptions): Promise>; /** - * The method adds a function called `name` on the `window` object of every frame in this page. When called, the - * function executes `callback` and returns a [Promise] which resolves to the return value of `callback`. If the - * `callback` returns a [Promise], it will be awaited. + * The method adds a function called + * [`name`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-name) on the `window` object of + * every frame in this page. When called, the function executes + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-callback) and returns a + * [Promise] which resolves to the return value of + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-callback). If the + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-callback) returns a [Promise], + * it will be awaited. * - * The first argument of the `callback` function contains information about the caller: `{ browserContext: - * BrowserContext, page: Page, frame: Frame }`. + * The first argument of the + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-callback) function contains + * information about the caller: `{ browserContext: BrowserContext, page: Page, frame: Frame }`. * * See * [browserContext.exposeBinding(name, callback[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-expose-binding) @@ -818,12 +911,18 @@ export interface Page { */ exposeBinding(name: string, playwrightBinding: (source: BindingSource, arg: JSHandle) => any, options: { handle: true }): Promise; /** - * The method adds a function called `name` on the `window` object of every frame in this page. When called, the - * function executes `callback` and returns a [Promise] which resolves to the return value of `callback`. If the - * `callback` returns a [Promise], it will be awaited. + * The method adds a function called + * [`name`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-name) on the `window` object of + * every frame in this page. When called, the function executes + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-callback) and returns a + * [Promise] which resolves to the return value of + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-callback). If the + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-callback) returns a [Promise], + * it will be awaited. * - * The first argument of the `callback` function contains information about the caller: `{ browserContext: - * BrowserContext, page: Page, frame: Frame }`. + * The first argument of the + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-binding-option-callback) function contains + * information about the caller: `{ browserContext: BrowserContext, page: Page, frame: Frame }`. * * See * [browserContext.exposeBinding(name, callback[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-expose-binding) @@ -922,7 +1021,8 @@ export interface Page { /** * Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. * - * The arguments passed into `console.log` are available on the {@link ConsoleMessage} event handler argument. + * The arguments passed into `console.log` are available on the + * [ConsoleMessage](https://playwright.dev/docs/api/class-consolemessage) event handler argument. * * **Usage** * @@ -986,7 +1086,7 @@ export interface Page { /** * Emitted when attachment download started. User can access basic file operations on downloaded content via the - * passed {@link Download} instance. + * passed [Download](https://playwright.dev/docs/api/class-download) instance. */ on(event: 'download', listener: (download: Download) => any): this; @@ -1053,7 +1153,7 @@ export interface Page { * [browserContext.route(url, handler[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route) * and * [browserContext.on('request')](https://playwright.dev/docs/api/class-browsercontext#browser-context-event-request) - * respectively instead of similar methods on the {@link Page}. + * respectively instead of similar methods on the [Page](https://playwright.dev/docs/api/class-page). * * ```js * // Start waiting for popup before clicking. Note no await. @@ -1107,7 +1207,7 @@ export interface Page { on(event: 'response', listener: (response: Response) => any): this; /** - * Emitted when {@link WebSocket} request is sent. + * Emitted when [WebSocket](https://playwright.dev/docs/api/class-websocket) request is sent. */ on(event: 'websocket', listener: (webSocket: WebSocket) => any): this; @@ -1220,7 +1320,8 @@ export interface Page { /** * Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. * - * The arguments passed into `console.log` are available on the {@link ConsoleMessage} event handler argument. + * The arguments passed into `console.log` are available on the + * [ConsoleMessage](https://playwright.dev/docs/api/class-consolemessage) event handler argument. * * **Usage** * @@ -1284,7 +1385,7 @@ export interface Page { /** * Emitted when attachment download started. User can access basic file operations on downloaded content via the - * passed {@link Download} instance. + * passed [Download](https://playwright.dev/docs/api/class-download) instance. */ addListener(event: 'download', listener: (download: Download) => any): this; @@ -1351,7 +1452,7 @@ export interface Page { * [browserContext.route(url, handler[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route) * and * [browserContext.on('request')](https://playwright.dev/docs/api/class-browsercontext#browser-context-event-request) - * respectively instead of similar methods on the {@link Page}. + * respectively instead of similar methods on the [Page](https://playwright.dev/docs/api/class-page). * * ```js * // Start waiting for popup before clicking. Note no await. @@ -1405,7 +1506,7 @@ export interface Page { addListener(event: 'response', listener: (response: Response) => any): this; /** - * Emitted when {@link WebSocket} request is sent. + * Emitted when [WebSocket](https://playwright.dev/docs/api/class-websocket) request is sent. */ addListener(event: 'websocket', listener: (webSocket: WebSocket) => any): this; @@ -1613,7 +1714,8 @@ export interface Page { /** * Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. * - * The arguments passed into `console.log` are available on the {@link ConsoleMessage} event handler argument. + * The arguments passed into `console.log` are available on the + * [ConsoleMessage](https://playwright.dev/docs/api/class-consolemessage) event handler argument. * * **Usage** * @@ -1677,7 +1779,7 @@ export interface Page { /** * Emitted when attachment download started. User can access basic file operations on downloaded content via the - * passed {@link Download} instance. + * passed [Download](https://playwright.dev/docs/api/class-download) instance. */ prependListener(event: 'download', listener: (download: Download) => any): this; @@ -1744,7 +1846,7 @@ export interface Page { * [browserContext.route(url, handler[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route) * and * [browserContext.on('request')](https://playwright.dev/docs/api/class-browsercontext#browser-context-event-request) - * respectively instead of similar methods on the {@link Page}. + * respectively instead of similar methods on the [Page](https://playwright.dev/docs/api/class-page). * * ```js * // Start waiting for popup before clicking. Note no await. @@ -1798,7 +1900,7 @@ export interface Page { prependListener(event: 'response', listener: (response: Response) => any): this; /** - * Emitted when {@link WebSocket} request is sent. + * Emitted when [WebSocket](https://playwright.dev/docs/api/class-websocket) request is sent. */ prependListener(event: 'websocket', listener: (webSocket: WebSocket) => any): this; @@ -1826,7 +1928,8 @@ export interface Page { * handler is only called when you perform an action/assertion - if the overlay becomes visible but you don't * perform any actions, the handler will not be triggered. * - After executing the handler, Playwright will ensure that overlay that triggered the handler is not visible - * anymore. You can opt-out of this behavior with `noWaitAfter`. + * anymore. You can opt-out of this behavior with + * [`noWaitAfter`](https://playwright.dev/docs/api/class-page#page-add-locator-handler-option-no-wait-after). * - The execution time of the handler counts towards the timeout of the action/assertion that executed the handler. * If your handler takes too long, it might cause timeouts. * - You can register multiple handlers. However, only a single handler will be running at a time. Make sure the @@ -1876,8 +1979,9 @@ export interface Page { * ``` * * An example with a custom callback on every actionability check. It uses a `` locator that is always visible, - * so the handler is called before every actionability check. It is important to specify `noWaitAfter`, because the - * handler does not hide the `` element. + * so the handler is called before every actionability check. It is important to specify + * [`noWaitAfter`](https://playwright.dev/docs/api/class-page#page-add-locator-handler-option-no-wait-after), because + * the handler does not hide the `` element. * * ```js * // Setup the handler. @@ -1891,7 +1995,7 @@ export interface Page { * ``` * * Handler takes the original locator as an argument. You can also automatically remove the handler after a number of - * invocations by setting `times`: + * invocations by setting [`times`](https://playwright.dev/docs/api/class-page#page-add-locator-handler-option-times): * * ```js * await page.addLocatorHandler(page.getByLabel('Close'), async locator => { @@ -1900,8 +2004,9 @@ export interface Page { * ``` * * @param locator Locator that triggers the handler. - * @param handler Function that should be run once `locator` appears. This function should get rid of the element that blocks actions - * like click. + * @param handler Function that should be run once + * [`locator`](https://playwright.dev/docs/api/class-page#page-add-locator-handler-option-locator) appears. This + * function should get rid of the element that blocks actions like click. * @param options */ addLocatorHandler(locator: Locator, handler: ((locator: Locator) => Promise), options?: { @@ -1979,19 +2084,24 @@ export interface Page { * **NOTE** Use locator-based [locator.check([options])](https://playwright.dev/docs/api/class-locator#locator-check) instead. * Read more about [locators](https://playwright.dev/docs/locators). * - * This method checks an element matching `selector` by performing the following steps: - * 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. + * This method checks an element matching + * [`selector`](https://playwright.dev/docs/api/class-page#page-check-option-selector) by performing the following + * steps: + * 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-check-option-selector). + * If there is none, wait until a matching element is attached to the DOM. * 1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is * already checked, this method returns immediately. - * 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If - * the element is detached during the checks, the whole action is retried. + * 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless + * [`force`](https://playwright.dev/docs/api/class-page#page-check-option-force) option is set. If the element + * is detached during the checks, the whole action is retried. * 1. Scroll the element into view if needed. * 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to click in the center of the * element. * 1. Ensure that the element is now checked. If not, this method throws. * - * When all steps combined have not finished during the specified `timeout`, this method throws a {@link - * TimeoutError}. Passing zero timeout disables this. + * When all steps combined have not finished during the specified + * [`timeout`](https://playwright.dev/docs/api/class-page#page-check-option-timeout), this method throws a + * [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this. * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be * used. * @param options @@ -2043,17 +2153,24 @@ export interface Page { * **NOTE** Use locator-based [locator.click([options])](https://playwright.dev/docs/api/class-locator#locator-click) instead. * Read more about [locators](https://playwright.dev/docs/locators). * - * This method clicks an element matching `selector` by performing the following steps: - * 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. - * 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If - * the element is detached during the checks, the whole action is retried. + * This method clicks an element matching + * [`selector`](https://playwright.dev/docs/api/class-page#page-click-option-selector) by performing the following + * steps: + * 1. Find an element matching [`selector`](https://playwright.dev/docs/api/class-page#page-click-option-selector). + * If there is none, wait until a matching element is attached to the DOM. + * 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless + * [`force`](https://playwright.dev/docs/api/class-page#page-click-option-force) option is set. If the element + * is detached during the checks, the whole action is retried. * 1. Scroll the element into view if needed. * 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to click in the center of the - * element, or the specified `position`. - * 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set. - * - * When all steps combined have not finished during the specified `timeout`, this method throws a {@link - * TimeoutError}. Passing zero timeout disables this. + * element, or the specified + * [`position`](https://playwright.dev/docs/api/class-page#page-click-option-position). + * 1. Wait for initiated navigations to either succeed or fail, unless + * [`noWaitAfter`](https://playwright.dev/docs/api/class-page#page-click-option-no-wait-after) option is set. + * + * When all steps combined have not finished during the specified + * [`timeout`](https://playwright.dev/docs/api/class-page#page-click-option-timeout), this method throws a + * [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this. * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be * used. * @param options @@ -2128,13 +2245,16 @@ export interface Page { }): Promise; /** - * If `runBeforeUnload` is `false`, does not run any unload handlers and waits for the page to be closed. If - * `runBeforeUnload` is `true` the method will run unload handlers, but will **not** wait for the page to close. + * If [`runBeforeUnload`](https://playwright.dev/docs/api/class-page#page-close-option-run-before-unload) is `false`, + * does not run any unload handlers and waits for the page to be closed. If + * [`runBeforeUnload`](https://playwright.dev/docs/api/class-page#page-close-option-run-before-unload) is `true` the + * method will run unload handlers, but will **not** wait for the page to close. * * By default, `page.close()` **does not** run `beforeunload` handlers. * - * **NOTE** if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned and should be handled - * manually via [page.on('dialog')](https://playwright.dev/docs/api/class-page#page-event-dialog) event. + * **NOTE** if [`runBeforeUnload`](https://playwright.dev/docs/api/class-page#page-close-option-run-before-unload) is + * passed as true, a `beforeunload` dialog might be summoned and should be handled manually via + * [page.on('dialog')](https://playwright.dev/docs/api/class-page#page-event-dialog) event. * @param options */ close(options?: { @@ -2164,16 +2284,23 @@ export interface Page { * **NOTE** Use locator-based [locator.dblclick([options])](https://playwright.dev/docs/api/class-locator#locator-dblclick) * instead. Read more about [locators](https://playwright.dev/docs/locators). * - * This method double clicks an element matching `selector` by performing the following steps: - * 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. - * 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless `force` option is set. If - * the element is detached during the checks, the whole action is retried. + * This method double clicks an element matching + * [`selector`](https://playwright.dev/docs/api/class-page#page-dblclick-option-selector) by performing the following + * steps: + * 1. Find an element matching + * [`selector`](https://playwright.dev/docs/api/class-page#page-dblclick-option-selector). If there is none, + * wait until a matching element is attached to the DOM. + * 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the matched element, unless + * [`force`](https://playwright.dev/docs/api/class-page#page-dblclick-option-force) option is set. If the + * element is detached during the checks, the whole action is retried. * 1. Scroll the element into view if needed. * 1. Use [page.mouse](https://playwright.dev/docs/api/class-page#page-mouse) to double click in the center of the - * element, or the specified `position`. + * element, or the specified + * [`position`](https://playwright.dev/docs/api/class-page#page-dblclick-option-position). * - * When all steps combined have not finished during the specified `timeout`, this method throws a {@link - * TimeoutError}. Passing zero timeout disables this. + * When all steps combined have not finished during the specified + * [`timeout`](https://playwright.dev/docs/api/class-page#page-dblclick-option-timeout), this method throws a + * [TimeoutError](https://playwright.dev/docs/api/class-timeouterror). Passing zero timeout disables this. * * **NOTE** `page.dblclick()` dispatches two `click` events and a single `dblclick` event. * @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be @@ -2257,10 +2384,13 @@ export interface Page { * await page.dispatchEvent('button#submit', 'click'); * ``` * - * Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` - * properties and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default. + * Under the hood, it creates an instance of an event based on the given + * [`type`](https://playwright.dev/docs/api/class-page#page-dispatch-event-option-type), initializes it with + * [`eventInit`](https://playwright.dev/docs/api/class-page#page-dispatch-event-option-event-init) properties and + * dispatches it on the element. Events are `composed`, `cancelable` and bubble by default. * - * Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties: + * Since [`eventInit`](https://playwright.dev/docs/api/class-page#page-dispatch-event-option-event-init) is + * event-specific, please refer to the events documentation for the lists of initial properties: * - [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent) * - [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent/DeviceOrientationEvent) * - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent) @@ -2440,10 +2570,15 @@ export interface Page { }): Promise; /** - * The method adds a function called `name` on the `window` object of every frame in the page. When called, the - * function executes `callback` and returns a [Promise] which resolves to the return value of `callback`. + * The method adds a function called + * [`name`](https://playwright.dev/docs/api/class-page#page-expose-function-option-name) on the `window` object of + * every frame in the page. When called, the function executes + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-function-option-callback) and returns a + * [Promise] which resolves to the return value of + * [`callback`](https://playwright.dev/docs/api/class-page#page-expose-function-option-callback). * - * If the `callback` returns a [Promise], it will be awaited. + * If the [`callback`](https://playwright.dev/docs/api/class-page#page-expose-function-option-callback) returns a + * [Promise], it will be awaited. * * See * [browserContext.exposeFunction(name, callback)](https://playwright.dev/docs/api/class-browsercontext#browser-context-expose-function) @@ -2489,9 +2624,10 @@ export interface Page { * **NOTE** Use locator-based [locator.fill(value[, options])](https://playwright.dev/docs/api/class-locator#locator-fill) * instead. Read more about [locators](https://playwright.dev/docs/locators). * - * This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/docs/actionability) checks, - * focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string - * to clear the input field. + * This method waits for an element matching + * [`selector`](https://playwright.dev/docs/api/class-page#page-fill-option-selector), waits for + * [actionability](https://playwright.dev/docs/actionability) checks, focuses the element, fills it and triggers an `input` event after + * filling. Note that you can pass an empty string to clear the input field. * * If the target element is not an ``, `