I\'m trying to automatically fill a form from the website of my school. I\'ve seen some ways to do with javascrip.
Here is my code:
@Override
prote
this works for me for API version greater than 18
mWebView = findViewById(R.id.web_view);
String url = "https://duckduckgo.com";
mWebView.loadUrl(url);
mWebView.getSettings().setJavaScriptEnabled(true);
final String js = "javascript:document.getElementById('search_form_input_homepage').value='android';" +
"document.getElementById('search_button_homepage').click()";
mWebView.setWebViewClient(new WebViewClient(){
public void onPageFinished(WebView view, String url){
if(Build.VERSION.SDK_INT >= 19){
view.evaluateJavascript(js, new ValueCallback() {
@Override
public void onReceiveValue(String s) {
}
});
}
}
});
here important is view.evaluateJavascript