appium-remote-debugger
Version:
Appium proxy for Remote Debugger protocol
54 lines • 2.21 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RemoteDebuggerRealDevice = void 0;
const remote_debugger_1 = require("./remote-debugger");
const rpc_1 = require("./rpc");
const utils_1 = require("./utils");
class RemoteDebuggerRealDevice extends remote_debugger_1.RemoteDebugger {
_udid;
_useWebInspectorShim = false;
constructor(opts) {
super(opts);
this._udid = opts.udid;
this._skippedApps = ['lockdownd'];
}
/**
* Returns true if this instance is using the WebInspector shim service
* (required for iOS 18+ real devices).
*/
get useWebInspectorShim() {
return this._useWebInspectorShim;
}
async initRpcClient() {
const commonOpts = {
bundleId: this._bundleId,
platformVersion: this._platformVersion,
isSafari: this._isSafari,
logAllCommunication: this._logAllCommunication,
logAllCommunicationHexDump: this._logAllCommunicationHexDump,
socketChunkSize: this._socketChunkSize,
webInspectorMaxFrameLength: this._webInspectorMaxFrameLength,
udid: this._udid,
pageLoadTimeoutMs: this._pageLoadMs,
};
this._useWebInspectorShim = (0, utils_1.canUseWebInspectorShim)(this._platformVersion);
if (this._useWebInspectorShim) {
const shimClient = new rpc_1.RpcClientRealDeviceShim(commonOpts);
try {
await shimClient.connect();
this._rpcClient = shimClient;
this.log.info(`Using WebInspector shim service for iOS ${this._platformVersion}`);
return;
}
catch (err) {
this.log.warn(`Failed to start WebInspector shim service: ${err.message}. ` +
'Falling back to the legacy Web Inspector implementation.');
this._useWebInspectorShim = false;
}
}
this._rpcClient = new rpc_1.RpcClientRealDevice(commonOpts);
}
}
exports.RemoteDebuggerRealDevice = RemoteDebuggerRealDevice;
exports.default = RemoteDebuggerRealDevice;
//# sourceMappingURL=remote-debugger-real-device.js.map