diff --git a/src/dispatchers/frameDispatcher.ts b/src/dispatchers/frameDispatcher.ts index 4f218c979b..8d84bcc0e3 100644 --- a/src/dispatchers/frameDispatcher.ts +++ b/src/dispatchers/frameDispatcher.ts @@ -91,11 +91,11 @@ export class FrameDispatcher extends Dispatcher { - return { element: ElementHandleDispatcher.fromNullable(this._scope, await this._frame.$(params.selector)) }; + return { element: ElementHandleDispatcher.fromNullable(this._scope, await this._frame.querySelector(params.selector)) }; } async querySelectorAll(params: channels.FrameQuerySelectorAllParams, metadata: CallMetadata): Promise { - const elements = await this._frame.$$(params.selector); + const elements = await this._frame.querySelectorAll(params.selector); return { elements: elements.map(e => ElementHandleDispatcher.from(this._scope, e)) }; } diff --git a/src/server/frames.ts b/src/server/frames.ts index 08502310a3..e2e592f206 100644 --- a/src/server/frames.ts +++ b/src/server/frames.ts @@ -682,7 +682,7 @@ export class Frame extends SdkObject { return value; } - async $(selector: string): Promise | null> { + async querySelector(selector: string): Promise | null> { debugLogger.log('api', ` finding element using the selector "${selector}"`); return this._page.selectors._query(this, selector); } @@ -736,7 +736,7 @@ export class Frame extends SdkObject { } async evalOnSelectorAndWaitForSignals(selector: string, expression: string, isFunction: boolean | undefined, arg: any): Promise { - const handle = await this.$(selector); + const handle = await this.querySelector(selector); if (!handle) throw new Error(`Error: failed to find element matching selector "${selector}"`); const result = await handle.evaluateExpressionAndWaitForSignals(expression, isFunction, true, arg); @@ -751,7 +751,7 @@ export class Frame extends SdkObject { return result; } - async $$(selector: string): Promise[]> { + async querySelectorAll(selector: string): Promise[]> { return this._page.selectors._queryAll(this, selector, undefined, true /* adoptToMain */); } @@ -1092,7 +1092,7 @@ export class Frame extends SdkObject { const controller = new ProgressController(metadata, this); return controller.run(async progress => { progress.log(` checking visibility of "${selector}"`); - const element = await this.$(selector); + const element = await this.querySelector(selector); return element ? await element.isVisible() : false; }, this._page._timeoutSettings.timeout(options)); }