private JSONObject getCriteria ( JSONObject payload ) throws JSONException { if ( payload . has ( "criteria" ) ) { JSONObject json = payload . getJSONObject ( "criteria" ) ; return json ; } else if ( payload . has ( "using" ) ) { return getCriteriaFromWebDriverSelector ( payload ) ; } else { throw new InvalidSelectorException ( "wrong format for the findElement command " + payload ) ; } }
create the criteria for the request . If the request follows the webdriver protocol maps it to a criteria ios - driver understands .