Hi im trying to get my program to hit a submit button after entering some strings into a few text fields, but i cant get it to work.
Im using the following code:
web.loadUrl("http://ta.yrdsb.ca/yrdsb/");
web.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
String username=MainActivity.usernameString;
String password=MainActivity.passwordString;
view.loadUrl("javascript:document.getElementsByName('username')[0].value = '"+username+"'");
view.loadUrl("javascript:document.getElementsByName('password')[0].value = '"+password+"'");
view.loadUrl("javascript:(function() { document.getElementsByName('submit')[0].click()})()");
}
});
}
Adding my strings to the text fields is working, but the last line where i try to click the submit button is not. Any help would be greatly appreciated. Thanks