diff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.md index 3f4faa6b06..597a259a5e 100644 --- a/docs/src/api/class-frame.md +++ b/docs/src/api/class-frame.md @@ -919,7 +919,10 @@ Returns whether the element is hidden, the opposite of [visible](./actionability ### param: Frame.isHidden.selector = %%-input-selector-%% ### option: Frame.isHidden.strict = %%-input-strict-%% -### option: Frame.isHidden.timeout = %%-input-timeout-%% +### option: Frame.isHidden.timeout +- `timeout` <[float]> + +**DEPRECATED** This option is ignored. [`method: Frame.isHidden`] does not wait for the element to become hidden and returns immediately. ## async method: Frame.isVisible - returns: <[boolean]> @@ -929,7 +932,10 @@ Returns whether the element is [visible](./actionability.md#visible). [`option: ### param: Frame.isVisible.selector = %%-input-selector-%% ### option: Frame.isVisible.strict = %%-input-strict-%% -### option: Frame.isVisible.timeout = %%-input-timeout-%% +### option: Frame.isVisible.timeout +- `timeout` <[float]> + +**DEPRECATED** This option is ignored. [`method: Frame.isVisible`] does not wait for the element to become visible and returns immediately. ## method: Frame.locator - returns: <[Locator]> diff --git a/docs/src/api/class-locator.md b/docs/src/api/class-locator.md index 8fc5d01843..245f999e7e 100644 --- a/docs/src/api/class-locator.md +++ b/docs/src/api/class-locator.md @@ -602,14 +602,20 @@ Returns whether the element is [enabled](./actionability.md#enabled). Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible). -### option: Locator.isHidden.timeout = %%-input-timeout-%% +### option: Locator.isHidden.timeout +- `timeout` <[float]> + +**DEPRECATED** This option is ignored. [`method: Locator.isHidden`] does not wait for the element to become hidden and returns immediately. ## async method: Locator.isVisible - returns: <[boolean]> Returns whether the element is [visible](./actionability.md#visible). -### option: Locator.isVisible.timeout = %%-input-timeout-%% +### option: Locator.isVisible.timeout +- `timeout` <[float]> + +**DEPRECATED** This option is ignored. [`method: Locator.isVisible`] does not wait for the element to become visible and returns immediately. ## method: Locator.last - returns: <[Locator]> diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index 30129353c9..92ce9b0c63 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -2026,7 +2026,10 @@ Returns whether the element is hidden, the opposite of [visible](./actionability ### param: Page.isHidden.selector = %%-input-selector-%% ### option: Page.isHidden.strict = %%-input-strict-%% -### option: Page.isHidden.timeout = %%-input-timeout-%% +### option: Page.isHidden.timeout +- `timeout` <[float]> + +**DEPRECATED** This option is ignored. [`method: Page.isHidden`] does not wait for the element to become hidden and returns immediately. ## async method: Page.isVisible - returns: <[boolean]> @@ -2036,7 +2039,10 @@ Returns whether the element is [visible](./actionability.md#visible). [`option: ### param: Page.isVisible.selector = %%-input-selector-%% ### option: Page.isVisible.strict = %%-input-strict-%% -### option: Page.isVisible.timeout = %%-input-timeout-%% +### option: Page.isVisible.timeout +- `timeout` <[float]> + +**DEPRECATED** This option is ignored. [`method: Page.isVisible`] does not wait for the element to become visible and returns immediately. ## property: Page.keyboard - type: <[Keyboard]> @@ -2648,7 +2654,7 @@ page.select_option("select#colors", value=["red", "green", "blue"]) await page.SelectOptionAsync("select#colors", new[] { "blue" }); // single selection matching both the value and the label await page.SelectOptionAsync("select#colors", new[] { new SelectOptionValue() { Label = "blue" } }); -// multiple +// multiple await page.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" }); ``` diff --git a/src/protocol/channels.ts b/src/protocol/channels.ts index edaa64e7bc..c4b618ae65 100644 --- a/src/protocol/channels.ts +++ b/src/protocol/channels.ts @@ -1748,11 +1748,9 @@ export type FrameIsEnabledResult = { export type FrameIsHiddenParams = { selector: string, strict?: boolean, - timeout?: number, }; export type FrameIsHiddenOptions = { strict?: boolean, - timeout?: number, }; export type FrameIsHiddenResult = { value: boolean, @@ -1760,11 +1758,9 @@ export type FrameIsHiddenResult = { export type FrameIsVisibleParams = { selector: string, strict?: boolean, - timeout?: number, }; export type FrameIsVisibleOptions = { strict?: boolean, - timeout?: number, }; export type FrameIsVisibleResult = { value: boolean, @@ -3401,7 +3397,6 @@ export const commandsWithTracingSnapshots = new Set([ 'Frame.isChecked', 'Frame.isDisabled', 'Frame.isEnabled', - 'Frame.isHidden', 'Frame.isEditable', 'Frame.press', 'Frame.selectOption', diff --git a/src/protocol/protocol.yml b/src/protocol/protocol.yml index 0a9528a30c..9e9ff598fa 100644 --- a/src/protocol/protocol.yml +++ b/src/protocol/protocol.yml @@ -419,7 +419,7 @@ Playwright: socksClosed: parameters: uid: string - + Selectors: type: interface @@ -1422,17 +1422,13 @@ Frame: parameters: selector: string strict: boolean? - timeout: number? returns: value: boolean - tracing: - snapshot: true isVisible: parameters: selector: string strict: boolean? - timeout: number? returns: value: boolean diff --git a/src/protocol/validator.ts b/src/protocol/validator.ts index 4e0457a878..41cec92632 100644 --- a/src/protocol/validator.ts +++ b/src/protocol/validator.ts @@ -717,12 +717,10 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme { scheme.FrameIsHiddenParams = tObject({ selector: tString, strict: tOptional(tBoolean), - timeout: tOptional(tNumber), }); scheme.FrameIsVisibleParams = tObject({ selector: tString, strict: tOptional(tBoolean), - timeout: tOptional(tNumber), }); scheme.FrameIsEditableParams = tObject({ selector: tString, diff --git a/src/server/frames.ts b/src/server/frames.ts index 26d77f0283..42f676874a 100644 --- a/src/server/frames.ts +++ b/src/server/frames.ts @@ -1105,16 +1105,16 @@ export class Frame extends SdkObject { return dom.throwFatalDOMError(dom.throwRetargetableDOMError(result)); } - async isVisible(metadata: CallMetadata, selector: string, options: types.QueryOnSelectorOptions = {}): Promise { + async isVisible(metadata: CallMetadata, selector: string, options: types.StrictOptions = {}): Promise { const controller = new ProgressController(metadata, this); return controller.run(async progress => { progress.log(` checking visibility of "${selector}"`); const element = await this.querySelector(selector, options); return element ? await element.isVisible() : false; - }, this._page._timeoutSettings.timeout(options)); + }, this._page._timeoutSettings.timeout({})); } - async isHidden(metadata: CallMetadata, selector: string, options: types.QueryOnSelectorOptions = {}): Promise { + async isHidden(metadata: CallMetadata, selector: string, options: types.StrictOptions = {}): Promise { return !(await this.isVisible(metadata, selector, options)); } diff --git a/types/types.d.ts b/types/types.d.ts index 17f1329366..525ed4e374 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -2033,10 +2033,10 @@ export interface Page { strict?: boolean; /** - * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by - * using the - * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) - * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods. + * **DEPRECATED** This option is ignored. + * [page.isHidden(selector[, options])](https://playwright.dev/docs/api/class-page#page-is-hidden) does not wait for the + * element to become hidden and returns immediately. + * @deprecated */ timeout?: number; }): Promise; @@ -2055,10 +2055,10 @@ export interface Page { strict?: boolean; /** - * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by - * using the - * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) - * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods. + * **DEPRECATED** This option is ignored. + * [page.isVisible(selector[, options])](https://playwright.dev/docs/api/class-page#page-is-visible) does not wait for the + * element to become visible and returns immediately. + * @deprecated */ timeout?: number; }): Promise; @@ -4302,10 +4302,10 @@ export interface Frame { strict?: boolean; /** - * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by - * using the - * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) - * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods. + * **DEPRECATED** This option is ignored. + * [frame.isHidden(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-is-hidden) does not wait for the + * element to become hidden and returns immediately. + * @deprecated */ timeout?: number; }): Promise; @@ -4324,10 +4324,10 @@ export interface Frame { strict?: boolean; /** - * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by - * using the - * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) - * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods. + * **DEPRECATED** This option is ignored. + * [frame.isVisible(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-is-visible) does not wait for + * the element to become visible and returns immediately. + * @deprecated */ timeout?: number; }): Promise; @@ -7668,10 +7668,10 @@ export interface Locator { */ isHidden(options?: { /** - * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by - * using the - * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) - * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods. + * **DEPRECATED** This option is ignored. + * [locator.isHidden([options])](https://playwright.dev/docs/api/class-locator#locator-is-hidden) does not wait for the + * element to become hidden and returns immediately. + * @deprecated */ timeout?: number; }): Promise; @@ -7682,10 +7682,10 @@ export interface Locator { */ isVisible(options?: { /** - * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by - * using the - * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) - * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods. + * **DEPRECATED** This option is ignored. + * [locator.isVisible([options])](https://playwright.dev/docs/api/class-locator#locator-is-visible) does not wait for the + * element to become visible and returns immediately. + * @deprecated */ timeout?: number; }): Promise;