@Override
  public Object executeScript(JSONArray args) {
    Integer id = null;
    try {
      if (args.get(0) instanceof JSONObject) {
        id = ((AndroidRElement)session.getKnownElements().get(args.getJSONObject(0).getString("ELEMENT"))).id;
      } else {
        // assume an integer
        id = args.getInt(0);
      }

    } catch (Exception e) {
      SelendroidLogger.error("Cannot invoke menu action", e);
      return "Must pass an AndroidRElement or integer to invokeMenuActionSync (check adb log for full stacktrace): " + e.getMessage();
    }
    serverInstrumentation.getInstrumentation().invokeMenuActionSync(serverInstrumentation.getCurrentActivity(), id, 0);
    return "invoked";
  }
@deprecated Please use new implemented extension mechanism
@see <a href="https://github.com/selendroid/selendroid-extension">extension mechanism Docu</a>
selendroid-server/src/main/java/io/selendroid/server/model/internal/execute_native/InvokeMenuAction.java