How to use appium-remote-debugger - 7 common examples

To help you get started, we’ve selected a few appium-remote-debugger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium-ios-driver / lib / commands / context.js View on Github external
'that the proxy is running and accessible');
      this.remote = null;
      pageArray = [];
    }
  } else {
    // simulator, and not connected
    this.remote = await this.getNewRemoteDebugger();

    let appInfo = await this.remote.connect();
    if (!appInfo) {
      logger.debug('Unable to connect to the remote debugger.');
      return [];
    }
    pageArray = await this.remote.selectApp(currentUrl, this.opts.webviewConnectRetries, this.opts.ignoreAboutBlankUrl);
    this.remote.on(RemoteDebugger.EVENT_PAGE_CHANGE, this.onPageChange.bind(this));
    this.remote.on(RemoteDebugger.EVENT_FRAMES_DETACHED, () => {
      if (!_.isEmpty(this.curWebFrames)) {
        logger.debug(`Clearing ${this.curWebFrames.length} frames: ${this.curWebFrames.join(', ')}`);
      }
      this.curWebFrames = [];
    });

    let tryClosingAlert = async () => {
      let didDismiss = await this.closeAlertBeforeTest();
      if (!didDismiss) {
        throw new Error('Close alert failed. Retry.');
      }
    };
    try {
      await retryInterval(3, 4000, tryClosingAlert);
    } catch (err) {
      // if the loop to close alerts failed to dismiss, ignore,
github appium / appium-ios-driver / lib / commands / context.js View on Github external
'ios-webkit-debug-proxy. If you expect to find webviews, please ensure ' +
                  'that the proxy is running and accessible');
      this.remote = null;
      pageArray = [];
    }
  } else {
    // simulator, and not connected
    this.remote = await this.getNewRemoteDebugger();

    let appInfo = await this.remote.connect();
    if (!appInfo) {
      logger.debug('Unable to connect to the remote debugger.');
      return [];
    }
    pageArray = await this.remote.selectApp(currentUrl, this.opts.webviewConnectRetries, this.opts.ignoreAboutBlankUrl);
    this.remote.on(RemoteDebugger.EVENT_PAGE_CHANGE, this.onPageChange.bind(this));
    this.remote.on(RemoteDebugger.EVENT_FRAMES_DETACHED, () => {
      if (!_.isEmpty(this.curWebFrames)) {
        logger.debug(`Clearing ${this.curWebFrames.length} frames: ${this.curWebFrames.join(', ')}`);
      }
      this.curWebFrames = [];
    });

    let tryClosingAlert = async () => {
      let didDismiss = await this.closeAlertBeforeTest();
      if (!didDismiss) {
        throw new Error('Close alert failed. Retry.');
      }
    };
    try {
      await retryInterval(3, 4000, tryClosingAlert);
    } catch (err) {
github appium / appium-ios-driver / lib / commands / context.js View on Github external
extensions.getNewRemoteDebugger = async function getNewRemoteDebugger () { // eslint-disable-line require-await
  return new RemoteDebugger({
    bundleId: this.opts.bundleId,
    useNewSafari: this.useNewSafari(),
    pageLoadMs: this.pageLoadMs,
    platformVersion: this.opts.platformVersion,
    isSafari: this.isSafari(),
    remoteDebugProxy: this.opts.remoteDebugProxy,
    garbageCollectOnExecute: false,
    logFullResponse: !!this.opts.safariShowFullResponse,
  });
};
github appium / appium-ios-driver / lib / commands / context.js View on Github external
useUrl = useUrl && !!this.getCurrentUrl();
  logger.debug(`Selecting by url: ${useUrl} ${useUrl ? `(expected url: '${this.getCurrentUrl()}')` : ''}`);

  let currentUrl = useUrl ? this.getCurrentUrl() : undefined;
  let pageArray;
  if (this.isRealDevice() && this.remote && this.opts.bundleId) {
    // real device, and already connected
    pageArray = await this.remote.pageArrayFromJson(this.opts.ignoreAboutBlankUrl);
  } else if (this.remote && this.remote.appIdKey) {
    // simulator, and already connected
    pageArray = await this.remote.selectApp(currentUrl, this.opts.webviewConnectRetries, this.opts.ignoreAboutBlankUrl);
  } else if (this.isRealDevice()) {
    // real device, and not connected
    try {
      this.remote = new WebKitRemoteDebugger({
        port: this.opts.webkitDebugProxyPort,
        webkitResponseTimeout: this.opts.webkitResponseTimeout,
        platformVersion: this.opts.platformVersion,
        isSafari: this.isSafari(),
        garbageCollectOnExecute: false,
        logFullResponse: !!this.opts.safariShowFullResponse,
      });
      pageArray = await this.remote.pageArrayFromJson(this.opts.ignoreAboutBlankUrl);
    } catch (err) {
      // it is reasonable to expect that this might be called when there is no
      // webkit remote debugger to connect to
      if (!_.includes(err.message, 'connect ECONNREFUSED')) throw err; // eslint-disable-line curly

      logger.warn('Attempted to get a list of webview contexts but could not connect to ' +
                  'ios-webkit-debug-proxy. If you expect to find webviews, please ensure ' +
                  'that the proxy is running and accessible');
github appium / appium-xcuitest-driver / lib / commands / context.js View on Github external
extensions.connectToRemoteDebugger = async function connectToRemoteDebugger () {
  this.remote = await this.getNewRemoteDebugger();
  await this.remote.connect();

  this.remote.on(RemoteDebugger.EVENT_PAGE_CHANGE, this.onPageChange.bind(this));
  this.remote.on(RemoteDebugger.EVENT_FRAMES_DETACHED, () => {
    if (!_.isEmpty(this.curWebFrames)) {
      log.debug(`Clearing ${this.curWebFrames.length} frames: ${this.curWebFrames.join(', ')}`);
    }
    this.curWebFrames = [];
  });
};
github appium / appium-xcuitest-driver / lib / commands / context.js View on Github external
extensions.connectToRemoteDebugger = async function connectToRemoteDebugger () {
  this.remote = await this.getNewRemoteDebugger();
  await this.remote.connect();

  this.remote.on(RemoteDebugger.EVENT_PAGE_CHANGE, this.onPageChange.bind(this));
  this.remote.on(RemoteDebugger.EVENT_FRAMES_DETACHED, () => {
    if (!_.isEmpty(this.curWebFrames)) {
      log.debug(`Clearing ${this.curWebFrames.length} frames: ${this.curWebFrames.join(', ')}`);
    }
    this.curWebFrames = [];
  });
};
github appium / appium-xcuitest-driver / lib / commands / context.js View on Github external
extensions.getNewRemoteDebugger = async function getNewRemoteDebugger () {
  let socketPath;
  if (!this.isRealDevice()) {
    socketPath = await this.opts.device.getWebInspectorSocket();
  }
  return createRemoteDebugger({
    bundleId: this.opts.bundleId,
    additionalBundleIds: this.opts.additionalWebviewBundleIds,
    isSafari: this.isSafari(),
    includeSafari: this.opts.includeSafariInWebviews,
    useNewSafari: this.useNewSafari(),
    pageLoadMs: this.pageLoadMs,
    platformVersion: this.opts.platformVersion,
    socketPath,
    remoteDebugProxy: this.opts.remoteDebugProxy,
    garbageCollectOnExecute: util.hasValue(this.opts.safariGarbageCollect)
      ? !!this.opts.safariGarbageCollect
      : false,
    udid: this.opts.udid,
    logAllCommunication: this.opts.safariLogAllCommunication,
    logAllCommunicationHexDump: this.opts.safariLogAllCommunicationHexDump,
    socketChunkSize: this.opts.safariSocketChunkSize,