MCPcopy Create free account
hub / github.com/appium/appium / executeMethod

Method executeMethod

packages/base-plugin/lib/plugin.ts:43–60  ·  view source on GitHub ↗

* A convenience method for plugins that implement their own `executeMethodMap`. * Pass through to the driver's execute method if the plugin does not handle the script.

(
    next: NextPluginCallback,
    driver: Driver<C>,
    script: string,
    protoArgs: readonly [StringRecord<unknown>] | readonly unknown[],
  )

Source from the content-addressed store, hash-verified

41 * Pass through to the driver's execute method if the plugin does not handle the script.
42 */
43 async executeMethod<C extends Constraints>(
44 next: NextPluginCallback,
45 driver: Driver<C>,
46 script: string,
47 protoArgs: readonly [StringRecord<unknown>] | readonly unknown[],
48 ): Promise<unknown> {
49 const PluginClass = this.constructor as typeof BasePlugin;
50 const commandMetadata = {...PluginClass.executeMethodMap?.[script]};
51
52 if (!commandMetadata.command || !(commandMetadata.command in this)) {
53 this.log.info(`Plugin did not know how to handle method '${script}'. Passing control to next`);
54 return await next();
55 }
56
57 const command = this[commandMetadata.command as keyof this] as PluginCommand<ExternalDriver<C>>;
58 const args = validateExecuteMethodParams(protoArgs as unknown[], commandMetadata.params);
59 return await command.call(this, next, driver, ...args);
60 }
61}

Callers

nothing calls this directly

Calls 3

infoMethod · 0.65
nextFunction · 0.50

Tested by

no test coverage detected