title: programmatic click in Android WebView
body: <p>I have a website with <code>href</code> in it which redirected me to https </p>
  
  <pre><code>&lt;a id="mA" href="javascript:pLogin(2)" class="login-link__link private-cab-link"&gt;&lt;i class="icon-user"&gt;&lt;/i&gt;Авторизация&lt;/a&gt;
  </code></pre>
  
  <p>So, I can click on it by JavaScript. It works in chrome console </p>
  
  <pre><code>javascript:(function(){document.getElementById('mA').click();})()
  </code></pre>
  
  <p>Now I'm trying to do the same in WebView by clicking my app's button.</p>
  
  <pre><code>public class RostelecomLoginActivity extends Activity {
  
      WebView webView;
      String url;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
          setContentView(R.layout.activity_rostelecom_login);
          Intent webIntent = getIntent();
          String url = webIntent.getStringExtra("url");
  
          webView = (WebView) findViewById(R.id.webView1);
          webView.setWebViewClient(new MeWebViewClient());
          webView.getSettings().setJavaScriptEnabled(true);
          webView.getSettings().setSaveFormData(true);
          webView.getSettings().setSavePassword(true);
          webView.loadUrl(url);
  
          Button buttoner = (Button) findViewById(R.id.button1);
          buttoner.setOnClickListener(new OnClickListener() {
  
              public void onClick(View v) {
                  webView.loadUrl("javascript:(function(){document.getElementById('mA').click();})()");
              }
          });
  
      }
  
  }
  </code></pre>
  
  <p>I'm using MyWebViewClient to allow all certificates</p>
  
  <pre><code>public class MeWebViewClient extends WebViewClient {
  
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url) {
          view.loadUrl(url);
          return true;
      }
  
      @Override
      public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
          handler.proceed();
      }
  }
  </code></pre>
  
  <p>The js injection doesn't work. If I click on href in WebView it works.
  What can be wrong?</p>