I am trying to fill in a few fields(Working) then click the login button(Not Working) I have tried:
document.getElementById('loginButton').click();"
and
document.forms['form'].submit();
The button name and form name are correct, what am I doing wrong?
webview.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url)
{
webview.loadUrl("javascript:(function() { " +
"document.getElementById('coCode').value = 'CompanyCode';" +
"document.getElementById('loginName').value = 'LoginName';" +
"document.getElementById('password').value = 'Password';" +
//"document.forms['form'].submit();" + //Doesn't Work
//"document.getElementById('loginButton').click();" + //Doesn't Work
"})()");
}
});
document.forms["form"].submit();should work, have you checked that it (the javascript function) is happy in a standalone browser?