This reverts commit 9f71c96740.
This commit is contained in:
parent
43ecb8aa94
commit
d1170b30fc
|
|
@ -910,6 +910,8 @@ Returns whether the element is hidden, the opposite of [visible](./actionability
|
|||
|
||||
### param: Frame.isHidden.selector = %%-input-selector-%%
|
||||
|
||||
### option: Frame.isHidden.timeout = %%-input-timeout-%%
|
||||
|
||||
## async method: Frame.isVisible
|
||||
- returns: <[boolean]>
|
||||
|
||||
|
|
@ -917,6 +919,8 @@ Returns whether the element is [visible](./actionability.md#visible). [`option:
|
|||
|
||||
### param: Frame.isVisible.selector = %%-input-selector-%%
|
||||
|
||||
### option: Frame.isVisible.timeout = %%-input-timeout-%%
|
||||
|
||||
## method: Frame.name
|
||||
- returns: <[string]>
|
||||
|
||||
|
|
|
|||
|
|
@ -2018,6 +2018,8 @@ Returns whether the element is hidden, the opposite of [visible](./actionability
|
|||
|
||||
### param: Page.isHidden.selector = %%-input-selector-%%
|
||||
|
||||
### option: Page.isHidden.timeout = %%-input-timeout-%%
|
||||
|
||||
## async method: Page.isVisible
|
||||
- returns: <[boolean]>
|
||||
|
||||
|
|
@ -2025,6 +2027,8 @@ Returns whether the element is [visible](./actionability.md#visible). [`option:
|
|||
|
||||
### param: Page.isVisible.selector = %%-input-selector-%%
|
||||
|
||||
### option: Page.isVisible.timeout = %%-input-timeout-%%
|
||||
|
||||
## property: Page.keyboard
|
||||
- type: <[Keyboard]>
|
||||
|
||||
|
|
@ -2623,7 +2627,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" });
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -372,15 +372,15 @@ export class Frame extends ChannelOwner<channels.FrameChannel, channels.FrameIni
|
|||
});
|
||||
}
|
||||
|
||||
async isHidden(selector: string): Promise<boolean> {
|
||||
async isHidden(selector: string, options: channels.FrameIsHiddenOptions = {}): Promise<boolean> {
|
||||
return this._wrapApiCall(async (channel: channels.FrameChannel) => {
|
||||
return (await channel.isHidden({ selector })).value;
|
||||
return (await channel.isHidden({ selector, ...options })).value;
|
||||
});
|
||||
}
|
||||
|
||||
async isVisible(selector: string): Promise<boolean> {
|
||||
async isVisible(selector: string, options: channels.FrameIsVisibleOptions = {}): Promise<boolean> {
|
||||
return this._wrapApiCall(async (channel: channels.FrameChannel) => {
|
||||
return (await channel.isVisible({ selector })).value;
|
||||
return (await channel.isVisible({ selector, ...options })).value;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -557,12 +557,12 @@ export class Page extends ChannelOwner<channels.PageChannel, channels.PageInitia
|
|||
return this._mainFrame.isEnabled(selector, options);
|
||||
}
|
||||
|
||||
async isHidden(selector: string): Promise<boolean> {
|
||||
return this._mainFrame.isHidden(selector);
|
||||
async isHidden(selector: string, options?: channels.FrameIsHiddenOptions): Promise<boolean> {
|
||||
return this._mainFrame.isHidden(selector, options);
|
||||
}
|
||||
|
||||
async isVisible(selector: string): Promise<boolean> {
|
||||
return this._mainFrame.isVisible(selector);
|
||||
async isVisible(selector: string, options?: channels.FrameIsVisibleOptions): Promise<boolean> {
|
||||
return this._mainFrame.isVisible(selector, options);
|
||||
}
|
||||
|
||||
async hover(selector: string, options?: channels.FrameHoverOptions) {
|
||||
|
|
|
|||
|
|
@ -175,11 +175,11 @@ export class FrameDispatcher extends Dispatcher<Frame, channels.FrameInitializer
|
|||
}
|
||||
|
||||
async isHidden(params: channels.FrameIsHiddenParams, metadata: CallMetadata): Promise<channels.FrameIsHiddenResult> {
|
||||
return { value: await this._frame.isHidden(metadata, params.selector) };
|
||||
return { value: await this._frame.isHidden(metadata, params.selector, params) };
|
||||
}
|
||||
|
||||
async isVisible(params: channels.FrameIsVisibleParams, metadata: CallMetadata): Promise<channels.FrameIsVisibleResult> {
|
||||
return { value: await this._frame.isVisible(metadata, params.selector) };
|
||||
return { value: await this._frame.isVisible(metadata, params.selector, params) };
|
||||
}
|
||||
|
||||
async hover(params: channels.FrameHoverParams, metadata: CallMetadata): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -1631,18 +1631,20 @@ export type FrameIsEnabledResult = {
|
|||
};
|
||||
export type FrameIsHiddenParams = {
|
||||
selector: string,
|
||||
timeout?: number,
|
||||
};
|
||||
export type FrameIsHiddenOptions = {
|
||||
|
||||
timeout?: number,
|
||||
};
|
||||
export type FrameIsHiddenResult = {
|
||||
value: boolean,
|
||||
};
|
||||
export type FrameIsVisibleParams = {
|
||||
selector: string,
|
||||
timeout?: number,
|
||||
};
|
||||
export type FrameIsVisibleOptions = {
|
||||
|
||||
timeout?: number,
|
||||
};
|
||||
export type FrameIsVisibleResult = {
|
||||
value: boolean,
|
||||
|
|
@ -3292,7 +3294,6 @@ export const commandsWithTracingSnapshots = new Set([
|
|||
'Frame.isDisabled',
|
||||
'Frame.isEnabled',
|
||||
'Frame.isHidden',
|
||||
'Frame.isVisible',
|
||||
'Frame.isEditable',
|
||||
'Frame.press',
|
||||
'Frame.selectOption',
|
||||
|
|
|
|||
|
|
@ -1356,6 +1356,7 @@ Frame:
|
|||
isHidden:
|
||||
parameters:
|
||||
selector: string
|
||||
timeout: number?
|
||||
returns:
|
||||
value: boolean
|
||||
tracing:
|
||||
|
|
@ -1364,10 +1365,9 @@ Frame:
|
|||
isVisible:
|
||||
parameters:
|
||||
selector: string
|
||||
timeout: number?
|
||||
returns:
|
||||
value: boolean
|
||||
tracing:
|
||||
snapshot: true
|
||||
|
||||
isEditable:
|
||||
parameters:
|
||||
|
|
|
|||
|
|
@ -671,9 +671,11 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
|||
});
|
||||
scheme.FrameIsHiddenParams = tObject({
|
||||
selector: tString,
|
||||
timeout: tOptional(tNumber),
|
||||
});
|
||||
scheme.FrameIsVisibleParams = tObject({
|
||||
selector: tString,
|
||||
timeout: tOptional(tNumber),
|
||||
});
|
||||
scheme.FrameIsEditableParams = tObject({
|
||||
selector: tString,
|
||||
|
|
|
|||
|
|
@ -1064,17 +1064,17 @@ export class Frame extends SdkObject {
|
|||
return dom.throwFatalDOMError(dom.throwRetargetableDOMError(result));
|
||||
}
|
||||
|
||||
async isVisible(metadata: CallMetadata, selector: string): Promise<boolean> {
|
||||
async isVisible(metadata: CallMetadata, selector: string, options: types.TimeoutOptions = {}): Promise<boolean> {
|
||||
const controller = new ProgressController(metadata, this);
|
||||
return controller.run(async progress => {
|
||||
progress.log(` checking visibility of "${selector}"`);
|
||||
const element = await this.$(selector);
|
||||
return element ? await element.isVisible() : false;
|
||||
}, this._page._timeoutSettings.timeout({}));
|
||||
}, this._page._timeoutSettings.timeout(options));
|
||||
}
|
||||
|
||||
async isHidden(metadata: CallMetadata, selector: string): Promise<boolean> {
|
||||
return !(await this.isVisible(metadata, selector));
|
||||
async isHidden(metadata: CallMetadata, selector: string, options: types.TimeoutOptions = {}): Promise<boolean> {
|
||||
return !(await this.isVisible(metadata, selector, options));
|
||||
}
|
||||
|
||||
async isDisabled(metadata: CallMetadata, selector: string, options: types.TimeoutOptions = {}): Promise<boolean> {
|
||||
|
|
|
|||
122
types/types.d.ts
vendored
122
types/types.d.ts
vendored
|
|
@ -367,35 +367,6 @@ export interface Page {
|
|||
*/
|
||||
exposeBinding(name: string, playwrightBinding: (source: BindingSource, arg: JSHandle) => any, options: { handle: true }): Promise<void>;
|
||||
exposeBinding(name: string, playwrightBinding: (source: BindingSource, ...args: any[]) => any, options?: { handle?: boolean }): Promise<void>;
|
||||
|
||||
/**
|
||||
* Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/docs/actionability#visible). `selector` that does not
|
||||
* match any elements is considered hidden.
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
|
||||
*/
|
||||
isHidden(selector: string): Promise<boolean>;
|
||||
isHidden(selector: string, options?: {
|
||||
/**
|
||||
* Option `timeout` has no effect.
|
||||
* @deprecated
|
||||
*/
|
||||
timeout?: number
|
||||
}): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns whether the element is [visible](https://playwright.dev/docs/actionability#visible). `selector` that does not match any elements is
|
||||
* considered not visible.
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
|
||||
*/
|
||||
isVisible(selector: string): Promise<boolean>;
|
||||
isVisible(selector: string, options?: {
|
||||
/**
|
||||
* Option `timeout` has no effect.
|
||||
* @deprecated
|
||||
*/
|
||||
timeout?: number
|
||||
}): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Emitted when the page closes.
|
||||
*/
|
||||
|
|
@ -1896,6 +1867,38 @@ export interface Page {
|
|||
timeout?: number;
|
||||
}): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/docs/actionability#visible). `selector` that does not
|
||||
* match any elements is considered hidden.
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
|
||||
* @param options
|
||||
*/
|
||||
isHidden(selector: string, 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.
|
||||
*/
|
||||
timeout?: number;
|
||||
}): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns whether the element is [visible](https://playwright.dev/docs/actionability#visible). `selector` that does not match any elements is
|
||||
* considered not visible.
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
|
||||
* @param options
|
||||
*/
|
||||
isVisible(selector: string, 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.
|
||||
*/
|
||||
timeout?: number;
|
||||
}): Promise<boolean>;
|
||||
|
||||
keyboard: Keyboard;
|
||||
|
||||
/**
|
||||
|
|
@ -3313,35 +3316,6 @@ export interface Frame {
|
|||
waitForSelector(selector: string, options?: PageWaitForSelectorOptionsNotHidden): Promise<ElementHandle<SVGElement | HTMLElement>>;
|
||||
waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options: PageWaitForSelectorOptions): Promise<ElementHandleForTag<K> | null>;
|
||||
waitForSelector(selector: string, options: PageWaitForSelectorOptions): Promise<null|ElementHandle<SVGElement | HTMLElement>>;
|
||||
|
||||
/**
|
||||
* Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/docs/actionability#visible). `selector` that does not
|
||||
* match any elements is considered hidden.
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
|
||||
*/
|
||||
isHidden(selector: string): Promise<boolean>;
|
||||
isHidden(selector: string, options?: {
|
||||
/**
|
||||
* Option `timeout` has no effect.
|
||||
* @deprecated
|
||||
*/
|
||||
timeout?: number
|
||||
}): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns whether the element is [visible](https://playwright.dev/docs/actionability#visible). `selector` that does not match any elements is
|
||||
* considered not visible.
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
|
||||
*/
|
||||
isVisible(selector: string): Promise<boolean>;
|
||||
isVisible(selector: string, options?: {
|
||||
/**
|
||||
* Option `timeout` has no effect.
|
||||
* @deprecated
|
||||
*/
|
||||
timeout?: number
|
||||
}): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns the added tag when the script's onload fires or when the script content was injected into frame.
|
||||
*
|
||||
|
|
@ -3947,6 +3921,38 @@ export interface Frame {
|
|||
timeout?: number;
|
||||
}): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/docs/actionability#visible). `selector` that does not
|
||||
* match any elements is considered hidden.
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
|
||||
* @param options
|
||||
*/
|
||||
isHidden(selector: string, 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.
|
||||
*/
|
||||
timeout?: number;
|
||||
}): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns whether the element is [visible](https://playwright.dev/docs/actionability#visible). `selector` that does not match any elements is
|
||||
* considered not visible.
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
|
||||
* @param options
|
||||
*/
|
||||
isVisible(selector: string, 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.
|
||||
*/
|
||||
timeout?: number;
|
||||
}): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns frame's name attribute as specified in the tag.
|
||||
*
|
||||
|
|
|
|||
38
utils/generate_types/overrides.d.ts
vendored
38
utils/generate_types/overrides.d.ts
vendored
|
|
@ -59,25 +59,6 @@ export interface Page {
|
|||
|
||||
exposeBinding(name: string, playwrightBinding: (source: BindingSource, arg: JSHandle) => any, options: { handle: true }): Promise<void>;
|
||||
exposeBinding(name: string, playwrightBinding: (source: BindingSource, ...args: any[]) => any, options?: { handle?: boolean }): Promise<void>;
|
||||
|
||||
isHidden(selector: string): Promise<boolean>;
|
||||
isHidden(selector: string, options?: {
|
||||
/**
|
||||
* Option `timeout` has no effect.
|
||||
* @deprecated
|
||||
*/
|
||||
timeout?: number
|
||||
}): Promise<boolean>;
|
||||
|
||||
isVisible(selector: string): Promise<boolean>;
|
||||
isVisible(selector: string, options?: {
|
||||
/**
|
||||
* Option `timeout` has no effect.
|
||||
* @deprecated
|
||||
*/
|
||||
timeout?: number
|
||||
}): Promise<boolean>;
|
||||
|
||||
}
|
||||
|
||||
export interface Frame {
|
||||
|
|
@ -110,25 +91,6 @@ export interface Frame {
|
|||
waitForSelector(selector: string, options?: PageWaitForSelectorOptionsNotHidden): Promise<ElementHandle<SVGElement | HTMLElement>>;
|
||||
waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options: PageWaitForSelectorOptions): Promise<ElementHandleForTag<K> | null>;
|
||||
waitForSelector(selector: string, options: PageWaitForSelectorOptions): Promise<null|ElementHandle<SVGElement | HTMLElement>>;
|
||||
|
||||
isHidden(selector: string): Promise<boolean>;
|
||||
isHidden(selector: string, options?: {
|
||||
/**
|
||||
* Option `timeout` has no effect.
|
||||
* @deprecated
|
||||
*/
|
||||
timeout?: number
|
||||
}): Promise<boolean>;
|
||||
|
||||
isVisible(selector: string): Promise<boolean>;
|
||||
isVisible(selector: string, options?: {
|
||||
/**
|
||||
* Option `timeout` has no effect.
|
||||
* @deprecated
|
||||
*/
|
||||
timeout?: number
|
||||
}): Promise<boolean>;
|
||||
|
||||
}
|
||||
|
||||
export interface BrowserContext {
|
||||
|
|
|
|||
|
|
@ -130,10 +130,6 @@ playwright.chromium.launch().then(async browser => {
|
|||
await page.emulateMedia({media: 'screen'});
|
||||
await page.pdf({ path: 'page.pdf' });
|
||||
|
||||
// Deprecated option still compiles.
|
||||
await page.isVisible('div', { timeout: 123 });
|
||||
await page.mainFrame().isHidden('div', { timeout: 123 });
|
||||
|
||||
await page.route('**/*', (route, interceptedRequest) => {
|
||||
if (
|
||||
interceptedRequest.url().endsWith('.png') ||
|
||||
|
|
|
|||
Loading…
Reference in a new issue