public JSONObject toJson() throws JSONException {
    JSONObject object = new JSONObject();
    JSONObject l10n = new JSONObject();
    l10n.put("matches", 0);
    object.put("l10n", l10n);
    CharSequence cd = getView().getContentDescription();
    if (cd != null && cd.length() > 0) {
      String label = String.valueOf(cd);
      object.put("name", label);
    } else {
      object.put("name", "");
    }
    String id = getNativeId();
    object.put("id", id.startsWith("id/") ? id.replace("id/", "") : id);
    JSONObject rect = new JSONObject();

    object.put("rect", rect);
    JSONObject origin = new JSONObject();
    Point location = getLocation();
    origin.put("x", location.x);
    origin.put("y", location.y);
    rect.put("origin", origin);

    JSONObject size = new JSONObject();
    Dimension s = getSize();
    size.put("height", s.getHeight());
    size.put("width", s.getWidth());
    rect.put("size", size);

    object.put("ref", ke.getIdOfElement(this));
    object.put("type", getView().getClass().getSimpleName());
    String value = "";
    if (getView() instanceof TextView) {
      TextView textView = (TextView) getView();
      value = String.valueOf(textView.getText());

      CharSequence error = textView.getError();
      if(error != null && error.length() > 0){
        SelendroidLogger.info("error: " + error);
        object.put("error", error);
      }
    }
    object.put("value", value);
    object.put("shown", getView().isShown());
    if (getView() instanceof WebView) {
      final WebView webview = (WebView) getView();
      final WebViewSourceClient client = new WebViewSourceClient();
      instrumentation.getCurrentActivity().runOnUiThread(new Runnable() {
        public void run() {
          synchronized (syncObject) {
            webview.getSettings().setJavaScriptEnabled(true);

            webview.setWebChromeClient(client);
            String script = "document.body.parentNode.innerHTML";
            webview.loadUrl("javascript:alert('selendroidSource:'+" + script + ")");
          }
        }
      });
      long end = System.currentTimeMillis() + 10000;
      waitForDone(end, UI_TIMEOUT, "Error while grabbing web view source code.");
      object.put("source", "<html>" + client.result + "</html>");
    }

    return object;
  }
If view.isShown() == false, logs why exactly this evaluates to false.
Copied from Android's implementation of View.isShown().
selendroid-server/src/main/java/io/selendroid/server/model/AndroidNativeElement.java