@appium/base-driver
Version:
Base driver class for Appium drivers
53 lines • 2.36 kB
TypeScript
import type { AppiumLogger, HTTPBody, ProxyResponse } from '@appium/types';
export type ProxyFunction = (url: string, method: string, body?: HTTPBody) => Promise<[ProxyResponse, HTTPBody]>;
export declare const COMMAND_URLS_CONFLICTS: readonly [{
readonly commandNames: readonly ["execute", "executeAsync"];
readonly jsonwpConverter: (url: string) => string;
readonly w3cConverter: (url: string) => string;
}, {
readonly commandNames: readonly ["getElementScreenshot"];
readonly jsonwpConverter: (url: string) => string;
readonly w3cConverter: (url: string) => string;
}, {
readonly commandNames: readonly ["getWindowHandles", "getWindowHandle"];
readonly jsonwpConverter: (url: string) => string;
readonly w3cConverter: (url: string) => string;
}, {
readonly commandNames: readonly ["getProperty"];
readonly jsonwpConverter: (w3cUrl: string) => string;
readonly w3cConverter: (jsonwpUrl: string) => string;
}];
export declare class ProtocolConverter {
proxyFunc: ProxyFunction;
private _downstreamProtocol;
private readonly _log;
/**
* @param proxyFunc - Function to perform the actual proxy request
* @param log - Logger instance, or null to use the default
*/
constructor(proxyFunc: ProxyFunction, log?: AppiumLogger | null);
get log(): AppiumLogger;
get downstreamProtocol(): string | null | undefined;
set downstreamProtocol(value: string | null | undefined);
/**
* Handle "crossing" endpoints for the case when upstream and downstream
* drivers operate different protocols.
*/
convertAndProxy(commandName: string, url: string, method: string, body?: HTTPBody): Promise<[ProxyResponse, HTTPBody]>;
/**
* W3C /timeouts can take as many as 3 timeout types at once, MJSONWP /timeouts only takes one
* at a time. So if we're using W3C and proxying to MJSONWP and there's more than one timeout type
* provided in the request, we need to do 3 proxies and combine the result.
*/
private getTimeoutRequestObjects;
/**
* Proxy an array of timeout objects and merge the result.
*/
private proxySetTimeouts;
private proxySetWindow;
private proxySetValue;
private proxySetFrame;
private proxyPerformActions;
private proxyReleaseActions;
}
//# sourceMappingURL=protocol-converter.d.ts.map