title: Android WebView always returns null for javascript getElementById on loadUrl
body: <p>I try to fill out a form inside a webview from the android client app. I know how it should work, but the getElementById always returns null for me. I tried it on different websites.</p>
  
  <p>Here is my example for www.google.com.</p>
  
  <pre><code>MyWebView view = new MyWebView(this);
  view.getSettings().setJavaScriptEnabled(true);
  view.loadUrl("http://www.google.com");
  view.setWebViewClient(new WebViewClient() {
      @Override
      public boolean shouldOverrideUrlLoading(WebView v, String url) {
          v.loadUrl(url);
          return true;
      }
      @Override
      public void onPageFinished(WebView v, String url) {
          v.loadUrl("javascript:document.getElementById('mib').value = 'aaa';");              
      }
  });
  setContentView(view);
  </code></pre>
  
  <p>And the MyWebView class (only for information).</p>
  
  <pre><code>class MyWebView extends WebView {
      Context context;
      public MyWebView(Context context) {
          super(context);
          this.context = context;
      }
      @Override
      public boolean onTouchEvent(MotionEvent event) {
          // do some multi touch stuff
          return true;
      }
  }
  </code></pre>
  
  <p>I always get the error:</p>
  
  <pre><code>09-01 04:35:26.453: I/chromium(2962): [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot set property 'value' of null", source: https://www.google.de/?gws_rd=ssl (1)
  </code></pre>
  
  <p>But the element "mib" should be on the site. Using a desktop browser (chrome with mobile simulation) everything is working fine. I have no idea, whats going wrong here.</p>
  
  <p>Thanks for hints!</p>
  
  <p>Edit:
  I got some progress. Regarding <a href="http://trentmilton.com/android-webview.html">this</a> site, I also need setDomStorageEnabled(true).
  No I can find the DOM object and set the value, but instead of showing the modified site I get a new blank one with only the value I set. E.g. a white blank site with the text "aaa".</p>