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
For me, it is required to fill multiple entries in form one by one on callback of each "webView.evaluateJavascript" Note: API version > 18
See below snippet for reference
ArrayList arr = new ArrayList();
arr.add("document.getElementsByName(\"tag_name\")[0].value = \"your_value\";");
.
.
.
call setValue(arr, 0)
private void setValue(final ArrayList arr, final int i) {
if (i < arr.size()) {
webView.evaluateJavascript(arr.get(i), new ValueCallback() {
@Override
public void onReceiveValue(String value) {
int j = i + 1;
setValue(arr, j);
}
});
}else{
webView.evaluateJavascript("document.getElementById(\"your_form_id\").submit();", new ValueCallback() {
@Override
public void onReceiveValue(String value) {
Toast.makeText(MainActivity.this, "Submitted: "+value, Toast.LENGTH_SHORT).show();
}
});
}
}