Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/src/api/class-frame.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]>
Expand All @@ -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]>
Expand Down
10 changes: 8 additions & 2 deletions docs/src/api/class-locator.md
Original file line number Diff line number Diff line change
Expand Up @@ -557,14 +557,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]>
Expand Down
12 changes: 9 additions & 3 deletions docs/src/api/class-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]>
Expand All @@ -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]>
Expand Down Expand Up @@ -2650,7 +2656,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" });
```

Expand Down
5 changes: 0 additions & 5 deletions src/protocol/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1686,23 +1686,19 @@ export type FrameIsEnabledResult = {
export type FrameIsHiddenParams = {
selector: string,
strict?: boolean,
timeout?: number,
};
export type FrameIsHiddenOptions = {
strict?: boolean,
timeout?: number,
};
export type FrameIsHiddenResult = {
value: boolean,
};
export type FrameIsVisibleParams = {
selector: string,
strict?: boolean,
timeout?: number,
};
export type FrameIsVisibleOptions = {
strict?: boolean,
timeout?: number,
};
export type FrameIsVisibleResult = {
value: boolean,
Expand Down Expand Up @@ -3380,7 +3376,6 @@ export const commandsWithTracingSnapshots = new Set([
'Frame.isChecked',
'Frame.isDisabled',
'Frame.isEnabled',
'Frame.isHidden',
'Frame.isEditable',
'Frame.press',
'Frame.selectOption',
Expand Down
4 changes: 0 additions & 4 deletions src/protocol/protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1384,17 +1384,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

Expand Down
2 changes: 0 additions & 2 deletions src/protocol/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,12 +699,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,
Expand Down
6 changes: 3 additions & 3 deletions src/server/frames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1091,16 +1091,16 @@ export class Frame extends SdkObject {
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);
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<boolean> {
async isHidden(metadata: CallMetadata, selector: string, options: types.StrictOptions = {}): Promise<boolean> {
return !(await this.isVisible(metadata, selector, options));
}

Expand Down
48 changes: 24 additions & 24 deletions types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;
Expand All @@ -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<boolean>;
Expand Down Expand Up @@ -4304,10 +4304,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<boolean>;
Expand All @@ -4326,10 +4326,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<boolean>;
Expand Down Expand Up @@ -7659,10 +7659,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<boolean>;
Expand All @@ -7673,10 +7673,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<boolean>;
Expand Down