Socket
Book a DemoInstallSign in
Socket

mobile-json-wire-protocol

Package Overview
Dependencies
Maintainers
7
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobile-json-wire-protocol

JavaScript implementation of the Mobile JSON Wire Protocol.

latest
Source
npmnpm
Version
1.3.3
Version published
Maintainers
7
Created
Source

mobile-json-wire-protocol

NPM version Downloads Dependency Status devDependency Status

Build Status Coverage Status

An abstraction of the Mobile JSON Wire Protocol (spec) with Appium extensions (as specified here).

Endpoints in the protocol

The Mobile JSON Wire Protocol package gives access to a number of endpoints documented here.

MobileJsonWireProtocol

The basic class, subclassed by drivers that will use the protocol.

routeConfiguringFunction (driver)

This function gives drivers access to the protocol routes. It returns a function that itself will take an Express application.

isSessionCommand (command)

Checks if the command needs to have a session associated with it.

ALL_COMMANDS

An array of all the commands that will be dispatched to by the Mobile JSON Wire Proxy endpoints.

NO_SESSION_ID_COMMANDS

An array of commands that do not need a session associated with them.

Errors

This package exports a number of classes and methods related to Selenium error handling. There are error classes for each Selenium error type (see here, as well as the context errors in the mobile spec). The list of errors, and their meanings, can be found here.

There are, in addition, two helper methods for dealing with errors

isErrorType (err, type)

  • checks if the err object is a Mobile JSON Wire Protocol error of a particular type
  • arguments
    • err - the error object to test
    • type - the error class to test against
  • usage
    import { errors, isErrorType } from 'mobile-json-wire-protocol';
    
    try {
      // do some stuff...
    } catch (err) {
      if (isErrorType(err, errors.InvalidCookieDomainError)) {
        // process...
      }
    }
    

errorFromCode (code, message)

  • retrieve the appropriate error for an error code, with the supplied message.
  • arguments
    • code - the integer error code for a Mobile JSON Wire Protocol error
    • message - the message to be encapsulated in the error
  • usage
    import { errors, errorFromCode } from 'mobile-json-wire-protocol';
    
    let error = errorFromCode(6, 'an error has occurred');
    
    console.log(error instanceof errors.NoSuchDriverError);
    // => true
    
    console.log(error.message === 'an error has occurred');
    // => true
    

Keywords

appium

FAQs

Package last updated on 15 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts