mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 14:11:50 +03:00
chore: rename $,$$ to readable names (#7848)
This commit is contained in:
parent
95001fe8d1
commit
d370f65713
@ -91,11 +91,11 @@ export class FrameDispatcher extends Dispatcher<Frame, channels.FrameInitializer
|
||||
}
|
||||
|
||||
async querySelector(params: channels.FrameQuerySelectorParams, metadata: CallMetadata): Promise<channels.FrameQuerySelectorResult> {
|
||||
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<channels.FrameQuerySelectorAllResult> {
|
||||
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)) };
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,7 @@ export class Frame extends SdkObject {
|
||||
return value;
|
||||
}
|
||||
|
||||
async $(selector: string): Promise<dom.ElementHandle<Element> | null> {
|
||||
async querySelector(selector: string): Promise<dom.ElementHandle<Element> | 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<any> {
|
||||
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<dom.ElementHandle<Element>[]> {
|
||||
async querySelectorAll(selector: string): Promise<dom.ElementHandle<Element>[]> {
|
||||
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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user