@Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    AndroidNativeElement other = (AndroidNativeElement) obj;
    // Not calling getView() here so inserting into a set with stale elements doesn't suddenly start
    // throwing.
    if (viewRef.get() == null) {
      if (other.viewRef.get() != null) return false;
    } else if (!getView().equals(other.viewRef.get())) return false;
    return true;
  }
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/AndroidNativeElement.java