docs: deprecate timeout option in isVisible/isHidden methods (#8371)
This commit is contained in:
parent
60829f8909
commit
827a909d36
|
|
@ -919,7 +919,10 @@ Returns whether the element is hidden, the opposite of [visible](./actionability
|
||||||
### param: Frame.isHidden.selector = %%-input-selector-%%
|
### param: Frame.isHidden.selector = %%-input-selector-%%
|
||||||
|
|
||||||
### option: Frame.isHidden.strict = %%-input-strict-%%
|
### 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
|
## async method: Frame.isVisible
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
@ -929,7 +932,10 @@ Returns whether the element is [visible](./actionability.md#visible). [`option:
|
||||||
### param: Frame.isVisible.selector = %%-input-selector-%%
|
### param: Frame.isVisible.selector = %%-input-selector-%%
|
||||||
|
|
||||||
### option: Frame.isVisible.strict = %%-input-strict-%%
|
### 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
|
## method: Frame.locator
|
||||||
- returns: <[Locator]>
|
- returns: <[Locator]>
|
||||||
|
|
|
||||||
|
|
@ -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).
|
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
|
## async method: Locator.isVisible
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
||||||
Returns whether the element is [visible](./actionability.md#visible).
|
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
|
## method: Locator.last
|
||||||
- returns: <[Locator]>
|
- returns: <[Locator]>
|
||||||
|
|
|
||||||
|
|
@ -2026,7 +2026,10 @@ Returns whether the element is hidden, the opposite of [visible](./actionability
|
||||||
### param: Page.isHidden.selector = %%-input-selector-%%
|
### param: Page.isHidden.selector = %%-input-selector-%%
|
||||||
|
|
||||||
### option: Page.isHidden.strict = %%-input-strict-%%
|
### 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
|
## async method: Page.isVisible
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
@ -2036,7 +2039,10 @@ Returns whether the element is [visible](./actionability.md#visible). [`option:
|
||||||
### param: Page.isVisible.selector = %%-input-selector-%%
|
### param: Page.isVisible.selector = %%-input-selector-%%
|
||||||
|
|
||||||
### option: Page.isVisible.strict = %%-input-strict-%%
|
### 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
|
## property: Page.keyboard
|
||||||
- type: <[Keyboard]>
|
- type: <[Keyboard]>
|
||||||
|
|
|
||||||
|
|
@ -1748,11 +1748,9 @@ export type FrameIsEnabledResult = {
|
||||||
export type FrameIsHiddenParams = {
|
export type FrameIsHiddenParams = {
|
||||||
selector: string,
|
selector: string,
|
||||||
strict?: boolean,
|
strict?: boolean,
|
||||||
timeout?: number,
|
|
||||||
};
|
};
|
||||||
export type FrameIsHiddenOptions = {
|
export type FrameIsHiddenOptions = {
|
||||||
strict?: boolean,
|
strict?: boolean,
|
||||||
timeout?: number,
|
|
||||||
};
|
};
|
||||||
export type FrameIsHiddenResult = {
|
export type FrameIsHiddenResult = {
|
||||||
value: boolean,
|
value: boolean,
|
||||||
|
|
@ -1760,11 +1758,9 @@ export type FrameIsHiddenResult = {
|
||||||
export type FrameIsVisibleParams = {
|
export type FrameIsVisibleParams = {
|
||||||
selector: string,
|
selector: string,
|
||||||
strict?: boolean,
|
strict?: boolean,
|
||||||
timeout?: number,
|
|
||||||
};
|
};
|
||||||
export type FrameIsVisibleOptions = {
|
export type FrameIsVisibleOptions = {
|
||||||
strict?: boolean,
|
strict?: boolean,
|
||||||
timeout?: number,
|
|
||||||
};
|
};
|
||||||
export type FrameIsVisibleResult = {
|
export type FrameIsVisibleResult = {
|
||||||
value: boolean,
|
value: boolean,
|
||||||
|
|
@ -3401,7 +3397,6 @@ export const commandsWithTracingSnapshots = new Set([
|
||||||
'Frame.isChecked',
|
'Frame.isChecked',
|
||||||
'Frame.isDisabled',
|
'Frame.isDisabled',
|
||||||
'Frame.isEnabled',
|
'Frame.isEnabled',
|
||||||
'Frame.isHidden',
|
|
||||||
'Frame.isEditable',
|
'Frame.isEditable',
|
||||||
'Frame.press',
|
'Frame.press',
|
||||||
'Frame.selectOption',
|
'Frame.selectOption',
|
||||||
|
|
|
||||||
|
|
@ -1422,17 +1422,13 @@ Frame:
|
||||||
parameters:
|
parameters:
|
||||||
selector: string
|
selector: string
|
||||||
strict: boolean?
|
strict: boolean?
|
||||||
timeout: number?
|
|
||||||
returns:
|
returns:
|
||||||
value: boolean
|
value: boolean
|
||||||
tracing:
|
|
||||||
snapshot: true
|
|
||||||
|
|
||||||
isVisible:
|
isVisible:
|
||||||
parameters:
|
parameters:
|
||||||
selector: string
|
selector: string
|
||||||
strict: boolean?
|
strict: boolean?
|
||||||
timeout: number?
|
|
||||||
returns:
|
returns:
|
||||||
value: boolean
|
value: boolean
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -717,12 +717,10 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
||||||
scheme.FrameIsHiddenParams = tObject({
|
scheme.FrameIsHiddenParams = tObject({
|
||||||
selector: tString,
|
selector: tString,
|
||||||
strict: tOptional(tBoolean),
|
strict: tOptional(tBoolean),
|
||||||
timeout: tOptional(tNumber),
|
|
||||||
});
|
});
|
||||||
scheme.FrameIsVisibleParams = tObject({
|
scheme.FrameIsVisibleParams = tObject({
|
||||||
selector: tString,
|
selector: tString,
|
||||||
strict: tOptional(tBoolean),
|
strict: tOptional(tBoolean),
|
||||||
timeout: tOptional(tNumber),
|
|
||||||
});
|
});
|
||||||
scheme.FrameIsEditableParams = tObject({
|
scheme.FrameIsEditableParams = tObject({
|
||||||
selector: tString,
|
selector: tString,
|
||||||
|
|
|
||||||
|
|
@ -1105,16 +1105,16 @@ export class Frame extends SdkObject {
|
||||||
return dom.throwFatalDOMError(dom.throwRetargetableDOMError(result));
|
return dom.throwFatalDOMError(dom.throwRetargetableDOMError(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
async isVisible(metadata: CallMetadata, selector: string, options: types.QueryOnSelectorOptions = {}): Promise<boolean> {
|
async isVisible(metadata: CallMetadata, selector: string, options: types.StrictOptions = {}): Promise<boolean> {
|
||||||
const controller = new ProgressController(metadata, this);
|
const controller = new ProgressController(metadata, this);
|
||||||
return controller.run(async progress => {
|
return controller.run(async progress => {
|
||||||
progress.log(` checking visibility of "${selector}"`);
|
progress.log(` checking visibility of "${selector}"`);
|
||||||
const element = await this.querySelector(selector, options);
|
const element = await this.querySelector(selector, options);
|
||||||
return element ? await element.isVisible() : false;
|
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<boolean> {
|
async isHidden(metadata: CallMetadata, selector: string, options: types.StrictOptions = {}): Promise<boolean> {
|
||||||
return !(await this.isVisible(metadata, selector, options));
|
return !(await this.isVisible(metadata, selector, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
48
types/types.d.ts
vendored
48
types/types.d.ts
vendored
|
|
@ -2033,10 +2033,10 @@ export interface Page {
|
||||||
strict?: boolean;
|
strict?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
|
* **DEPRECATED** This option is ignored.
|
||||||
* using the
|
* [page.isHidden(selector[, options])](https://playwright.dev/docs/api/class-page#page-is-hidden) does not wait for the
|
||||||
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
* element to become hidden and returns immediately.
|
||||||
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
}): Promise<boolean>;
|
}): Promise<boolean>;
|
||||||
|
|
@ -2055,10 +2055,10 @@ export interface Page {
|
||||||
strict?: boolean;
|
strict?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
|
* **DEPRECATED** This option is ignored.
|
||||||
* using the
|
* [page.isVisible(selector[, options])](https://playwright.dev/docs/api/class-page#page-is-visible) does not wait for the
|
||||||
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
* element to become visible and returns immediately.
|
||||||
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
}): Promise<boolean>;
|
}): Promise<boolean>;
|
||||||
|
|
@ -4302,10 +4302,10 @@ export interface Frame {
|
||||||
strict?: boolean;
|
strict?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
|
* **DEPRECATED** This option is ignored.
|
||||||
* using the
|
* [frame.isHidden(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-is-hidden) does not wait for the
|
||||||
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
* element to become hidden and returns immediately.
|
||||||
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
}): Promise<boolean>;
|
}): Promise<boolean>;
|
||||||
|
|
@ -4324,10 +4324,10 @@ export interface Frame {
|
||||||
strict?: boolean;
|
strict?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
|
* **DEPRECATED** This option is ignored.
|
||||||
* using the
|
* [frame.isVisible(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-is-visible) does not wait for
|
||||||
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
* the element to become visible and returns immediately.
|
||||||
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
}): Promise<boolean>;
|
}): Promise<boolean>;
|
||||||
|
|
@ -7668,10 +7668,10 @@ export interface Locator {
|
||||||
*/
|
*/
|
||||||
isHidden(options?: {
|
isHidden(options?: {
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
|
* **DEPRECATED** This option is ignored.
|
||||||
* using the
|
* [locator.isHidden([options])](https://playwright.dev/docs/api/class-locator#locator-is-hidden) does not wait for the
|
||||||
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
* element to become hidden and returns immediately.
|
||||||
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
}): Promise<boolean>;
|
}): Promise<boolean>;
|
||||||
|
|
@ -7682,10 +7682,10 @@ export interface Locator {
|
||||||
*/
|
*/
|
||||||
isVisible(options?: {
|
isVisible(options?: {
|
||||||
/**
|
/**
|
||||||
* Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
|
* **DEPRECATED** This option is ignored.
|
||||||
* using the
|
* [locator.isVisible([options])](https://playwright.dev/docs/api/class-locator#locator-is-visible) does not wait for the
|
||||||
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
* element to become visible and returns immediately.
|
||||||
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
}): Promise<boolean>;
|
}): Promise<boolean>;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue