title: How to get the Javascript messages from android webview
body: <p>Hey guys I wanted to inject some code into a webview and see whether the code has succeeded. I've tried to override the onConsoleMessage method of WebChromeClient but it only reports whether the code is an uncaught reference</p>
  
  <pre><code>public boolean onConsoleMessage (ConsoleMessage consoleMessage){
      System.out.println(consoleMessage.message());
  }
  </code></pre>
  
  <p>I only get messages like:</p>
  
  <pre><code>Uncaught ReferenceError: noob is not defined
  </code></pre>
  
  <p>When I execute a valid command like </p>
  
  <pre><code>document.getElementById("mainPage").innerHTML = "Hello Dolly.";
  </code></pre>
  
  <p>I would want to somehow know that the command succeeded or failed. The content of mainPage div changed fine but I got no messages from the onConsole method whether the command finished with success or not.
  Any idea what I could do?
  Thanks in advance</p>