I have a login form (made with WordPress) and I want the user of the application to access the web directly without having to login again.
With code, I am able to fill in the form fields (username and password), but I cannot click on the button.
My code is this:
WebSettings webSettings= wvProductos.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setDatabaseEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
wvProductos.loadUrl("MYWEB/SHOP/");
wvProductos.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
wvProductos.loadUrl(
"javascript:document.getElementById('username').value = '29075431G';" +
"javascript:document.getElementById('password').value = '29075431';" +
"javascript:document.getElementsByName('login').click();" );
}
});
I can fill the fields Username and Password, but the click event don't work.
any suggestions?