Back to Appium

Mobile JSON Wire Protocol

packages/appium/docs/en/reference/api/mjsonwp.md

7.9.03.6 KB
Original Source
<style> ul[data-md-component="toc"] .md-nav { display: none; } </style>

The following is a list of legacy Mobile JSON Wire Protocol (MJSONWP) endpoints supported in Appium.

getRotation

GET /session/:sessionId/rotation

MJSONWP documentation: Device Rotation

Retrieves the current spatial orientation of the device under test.

Response

Rotation - an object with the following properties:

NameDescriptionType
xDegrees by which the device is rotated on its X axisnumber
yDegrees by which the device is rotated on its Y axisnumber
zDegrees by which the device is rotated on its Z axisnumber

setRotation

POST /session/:sessionId/rotation

MJSONWP documentation: Device Rotation

Sets the spatial orientation of the device under test.

Parameters

NameDescriptionType
xDegrees by which the device is rotated on its X axisnumber
yDegrees by which the device is rotated on its Y axisnumber
zDegrees by which the device is rotated on its Z axisnumber

Response

null

getCurrentContext

GET /session/:sessionId/context

MJSONWP documentation: Webviews and Other Contexts

Retrieves the active application context.

Response

string - the name of the active context

setContext

POST /session/:sessionId/context

MJSONWP documentation: Webviews and Other Contexts

Sets an application context as the active context.

Parameters

NameDescriptionType
nameName of the context to set as the active onestring

Response

null

getContexts

GET /session/:sessionId/contexts

MJSONWP documentation: Webviews and Other Contexts

Retrieves all available application contexts.

Response

string[] - the names of available contexts

getNetworkConnection

GET /session/:sessionId/network_connection

MJSONWP documentation: Device Modes

Retrieves the current state of network types (data, Wi-Fi, airplane mode).

!!! warning "Deprecated"

Please use driver-specific extension methods such as `mobile: getConnectivity`

Response

NetworkConnectionState - a number indicating the current network state:

ValueDataWi-FiAirplane Mode
0OFFOFFOFF
1OFFOFFON
2OFFONOFF
4ONOFFOFF
6ONONOFF

setNetworkConnection

POST /session/:sessionId/network_connection

MJSONWP documentation: Device Modes

Sets the state of network types (data, Wi-Fi, airplane mode).

!!! warning "Deprecated"

Please use driver-specific extension methods such as `mobile: setConnectivity`

Parameters

<div style="width:6em">Name</div>Description<div style="width:18em">Type</div>
parametersObject containing the type key, whose value is the desired network state{"type": NetworkConnectionState}

Response

NetworkConnectionState - the new network state