title: Programmatically login on website
body: <p>Hi i would like to programmatically fill the login forms and invoke click button to login on some website.</p>
  
  <p>Im trying to achieve this like at this snippet:</p>
  
  <pre><code>public class LoginActivity extends Activity {
  WebView mWebView;
  Button btn;
  EditText txtLogin;
  EditText txtPassword;
  WebView webview;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
      btn = (Button)this.findViewById(R.id.button1); 
      txtLogin = (EditText)this.findViewById(R.id.txtLogin);
      txtPassword = (EditText)this.findViewById(R.id.txtPassword);
      webview = (WebView)findViewById(R.id.webView1);  
      webview.setWebViewClient(new WebClient());
      webview.getSettings().setJavaScriptEnabled(true);
      btn.setOnClickListener(new OnClickListener() 
      { 
           public void onClick(View v) 
           { 
  
               OpenWebContent();
           } 
      });         
  
  }
  public void OpenWebContent()
  {
       webview.loadUrl("http://www.www.com");          
  }
  
  public class WebClient extends WebViewClient {
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url) {
          view.loadUrl(url);
          return true;
      }
  
      @Override
      public void onPageFinished(WebView view, String url) 
      {       
  
                  view.loadUrl("javascript:(function() { " +  
                    "document.getElementsByTagName('user').value = " + "'mylogin'" + ";" +
                   "document.getElementsByTagName('password').value = " + "'mypassword'" + ";" +
                   "document.getElementsByTagName('input')[4].click(); " +  
                   "})()");   
  
      }
  }
  </code></pre>
  
  <p>Unfortunetly the code above not working. Did i omitted something? 
  Thank for any suggestion.</p>