I'm new to Android development and I am trying to make an app that will open a website and automatically set the username and password in the login form that appears.
Here is the code that I written to do this:
webView.loadUrl("http://www.bhos.edu.az/az/login?r=http://www.bhos.edu.az/az/page/67-imtahan-naticalari");
webView.getSettings().setDomStorageEnabled(true);
webView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
String user = "Foundation";
String pwd = "ZDxRvjS3";
view.loadUrl("javascript:document.getElementsByName('username').value = '"+user+"';document.getElementsByName('passwd').value='"+pwd+"';");
}
});
But when I run my app, I always see one of the values that I have set on a blank page, instead of the website.
Here's a screenshot of what I see:
How can I solve this?