private DomWindow processFrameExecutionResult(Object result) {
    if (result == null || "undefined".equals(result)) {
      return null;
    }
    try {
      JSONObject json = new JSONObject((String) result);
      JSONObject value = json.getJSONObject("value");
      return new DomWindow(value.getString("WINDOW"));
    } catch (JSONException e) {
      throw new RuntimeException("Failed to parse JavaScript result: " + result.toString(), e);
    }
  }
Unconventional way of adding a Javascript interface but the main reason why I took this way
is that it is working stable compared to the webview.addJavascriptInterface way.
selendroid-server/src/main/java/io/selendroid/server/model/SelendroidWebDriver.java