title: In Android, how can I set the value of a edit box in WebView using Javascript
body: <p>I understand how to set the value of a edit box in WebView, and in a browser on PC with Javascript. </p>
  
  <p>It is basically first find out the ID of the edit box (text), then set the value using:
  On PC:</p>
  
  <pre><code>document.getElementById('xxxxxxxx').value = 'test'
  </code></pre>
  
  <p>In Android:</p>
  
  <pre><code>mWebView.loadUrl("javascript: document.getElementById('xxxxxxxx').value = 'test'");
  </code></pre>
  
  <p>This script works in PC, but when I call the script in WebView.loadUrl, it just override my entire page to "test". </p>
  
  <p>It is weird to me because the following android code works on the radio button, but when it comes to the edit box, it just fails. </p>
  
  <pre><code>mWebView.loadUrl("javascript: document.getElementById('xxxxxxxx').checked = true");
  </code></pre>
  
  <p>Could you guys help me analyze what could be the possible reason? Thank you so much.</p>
  
  <p>To make it clear, I am running the javascript code in <strong>WebViewClient.onPageFinished(WebView view, String url)</strong>. So the WebView should be fully loaded. That also makes sense because I can check the radio button.</p>