diff --git a/docs/src/api/class-elementhandle.md b/docs/src/api/class-elementhandle.md index cc7e4021f0..3e2ed1e586 100644 --- a/docs/src/api/class-elementhandle.md +++ b/docs/src/api/class-elementhandle.md @@ -974,3 +974,5 @@ This method does not work across navigations, use [`method: Page.waitForSelector ### option: ElementHandle.waitForSelector.state = %%-wait-for-selector-state-%% ### option: ElementHandle.waitForSelector.timeout = %%-input-timeout-%% + +### option: ElementHandle.waitForSelector.strict = %%-input-strict-%% diff --git a/src/protocol/channels.ts b/src/protocol/channels.ts index c931502bfa..2f45338f61 100644 --- a/src/protocol/channels.ts +++ b/src/protocol/channels.ts @@ -1828,10 +1828,9 @@ export type FrameQuerySelectorResult = { }; export type FrameQuerySelectorAllParams = { selector: string, - strict?: boolean, }; export type FrameQuerySelectorAllOptions = { - strict?: boolean, + }; export type FrameQuerySelectorAllResult = { elements: ElementHandleChannel[], diff --git a/src/protocol/protocol.yml b/src/protocol/protocol.yml index 15658455e3..dc80f2fd44 100644 --- a/src/protocol/protocol.yml +++ b/src/protocol/protocol.yml @@ -1486,7 +1486,6 @@ Frame: querySelectorAll: parameters: selector: string - strict: boolean? returns: elements: type: array diff --git a/src/protocol/validator.ts b/src/protocol/validator.ts index a055c7c041..66ef420f36 100644 --- a/src/protocol/validator.ts +++ b/src/protocol/validator.ts @@ -754,7 +754,6 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme { }); scheme.FrameQuerySelectorAllParams = tObject({ selector: tString, - strict: tOptional(tBoolean), }); scheme.FrameSelectOptionParams = tObject({ selector: tString, diff --git a/types/types.d.ts b/types/types.d.ts index d16cace8e5..3c3041dfcc 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -12893,6 +12893,12 @@ interface ElementHandleWaitForSelectorOptions { */ state?: "attached"|"detached"|"visible"|"hidden"; + /** + * When true, the call requires selector to resolve to a single element. If given selector resolves to more then one + * element, the call throws an exception. + */ + strict?: boolean; + /** * Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by * using the