mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 13:45:36 +03:00
feat(rpc): inline selectors.register options in the protocol (#3072)
This commit is contained in:
parent
3dd61629e0
commit
18cb1c017a
@ -118,9 +118,7 @@ export interface SelectorsChannel extends Channel {
|
||||
export type SelectorsRegisterParams = {
|
||||
name: string,
|
||||
source: string,
|
||||
options: {
|
||||
contentScript?: boolean,
|
||||
},
|
||||
contentScript?: boolean,
|
||||
};
|
||||
export type SelectorsRegisterResult = void;
|
||||
export type SelectorsCreateSelectorParams = {
|
||||
|
@ -30,7 +30,7 @@ export class Selectors extends ChannelOwner<SelectorsChannel, SelectorsInitializ
|
||||
|
||||
async register(name: string, script: string | Function | { path?: string, content?: string }, options: { contentScript?: boolean } = {}): Promise<void> {
|
||||
const source = await helper.evaluationScript(script, undefined, false);
|
||||
await this._channel.register({ name, source, options });
|
||||
await this._channel.register({ ...options, name, source });
|
||||
}
|
||||
|
||||
async _createSelector(name: string, handle: ElementHandle<Element>): Promise<string | undefined> {
|
||||
|
@ -108,8 +108,7 @@ interface Selectors
|
||||
parameters
|
||||
name: string
|
||||
source: string
|
||||
options: object
|
||||
contentScript?: boolean
|
||||
contentScript?: boolean
|
||||
|
||||
command createSelector
|
||||
parameters
|
||||
|
@ -25,8 +25,8 @@ export class SelectorsDispatcher extends Dispatcher<Selectors, SelectorsInitiali
|
||||
super(scope, selectors, 'selectors', {});
|
||||
}
|
||||
|
||||
async register(params: { name: string, source: string, options: { contentScript?: boolean } }): Promise<void> {
|
||||
await this._object.register(params.name, params.source, params.options);
|
||||
async register(params: { name: string, source: string, contentScript?: boolean }): Promise<void> {
|
||||
await this._object.register(params.name, params.source, params);
|
||||
}
|
||||
|
||||
async createSelector(params: { name: string, handle: ElementHandleDispatcher }): Promise<{ value?: string }> {
|
||||
|
Loading…
Reference in New Issue
Block a user