webdriverio
Version:
Next-gen browser and mobile automation test framework for Node.js
91 lines • 4.02 kB
TypeScript
import type { Options } from '@wdio/types';
import type { ProtocolCommands } from '@wdio/protocols';
import type { BrowserCommandsType, WebdriverIOEventMap } from './types.js';
type EventEmitter = (args: unknown) => void;
type WrappedClient = {
options: Options.WebdriverIO;
commandList: (keyof (ProtocolCommands & BrowserCommandsType) & 'getInstance' & 'select')[];
__propertiesObject__?: Record<string, PropertyDescriptor>;
};
/**
* MultiRemote class
*/
export default class MultiRemote {
/**
* Browser sessions in capability order. Instance names are map keys,
* not properties of the browser client.
*/
instances: Map<string, WebdriverIO.Browser>;
baseInstance?: MultiRemoteDriver;
sessionId?: string;
/**
* add instance to multibrowser instance
*/
addInstance(browserName: string, client: WebdriverIO.Browser): Promise<WebdriverIO.Browser>;
/**
* modifier for multibrowser instance
*/
modifier(wrapperClient: WrappedClient): any;
/**
* the descriptors of a multi-remote element: the commands of the multi-remote browser and
* the element commands
*/
static elementProperties(propertiesObject: Record<string, PropertyDescriptor>): {
scope: {
value: string;
};
};
/**
* the command wrapper of a multi-remote element, which runs a command in every instance
*/
static elementCommandWrapper(scope: MultiRemote): (commandName: keyof WebdriverIO.Browser) => any;
/**
* The properties of the entries of one multi-remote list: the entries share their wrapped
* commands and the command wrapper, see `shareCommands`
*/
static listElements(propertiesObject: Record<string, PropertyDescriptor>, scope: MultiRemote): MultiRemoteListProperties;
/**
* helper method to generate element objects from results, so that we can call, e.g.
*
* ```
* const elem = $('#elem')
* elem.getHTML()
* ```
*
* or in case multi-remote is used
*
* ```
* const elems = $$('div')
* elems[0].getHTML()
* ```
*/
static elementWrapper(instances: Map<string, WebdriverIO.Browser>, result: unknown, propertiesObject: Record<string, PropertyDescriptor>, scope: MultiRemote, listProperties?: MultiRemoteListProperties): WebdriverIO.MultiRemoteElement;
/**
* handle commands for multi-remote instances
*/
commandWrapper(commandName: keyof (ProtocolCommands & BrowserCommandsType) & 'getInstance'): (...args: unknown[]) => Promise<unknown>;
}
/**
* the properties of the entries of one multi-remote list, see `MultiRemote.listElements`
*/
type MultiRemoteListProperties = Record<string | symbol, PropertyDescriptor>;
/**
* event listener class that propagates events to sub drivers
*/
export declare class MultiRemoteDriver {
instances: string[];
isMultiRemote: true;
__propertiesObject__: Record<string, PropertyDescriptor>;
constructor(instances: Map<string, WebdriverIO.Browser>, propertiesObject: Record<string, PropertyDescriptor>);
on(this: WebdriverIO.MultiRemoteBrowser, eventName: keyof WebdriverIOEventMap, emitter: EventEmitter): undefined;
once(this: WebdriverIO.MultiRemoteBrowser, eventName: keyof WebdriverIOEventMap, emitter: EventEmitter): undefined;
emit(this: WebdriverIO.MultiRemoteBrowser, eventName: keyof WebdriverIOEventMap, emitter: EventEmitter): boolean;
eventNames(this: WebdriverIO.MultiRemoteBrowser): (string | symbol)[][];
getMaxListeners(this: WebdriverIO.MultiRemoteBrowser): number[];
listenerCount(this: WebdriverIO.MultiRemoteBrowser, eventName: string): number[];
listeners(this: WebdriverIO.MultiRemoteBrowser, eventName: string): Function[];
removeListener(this: WebdriverIO.MultiRemoteBrowser, eventName: string, emitter: EventEmitter): undefined;
removeAllListeners(this: WebdriverIO.MultiRemoteBrowser, eventName: string): undefined;
}
export {};
//# sourceMappingURL=multiRemote.d.ts.map