I'm loading a website for searching ads into Webview in Java Android. I can pre-fill Searchkeyword field but I can't seem to trigger the Search icon click() to submit the search.
I use the same code on other websites and it works fine. I can trigger the click() event.
This is the website that i'm loading into WebView http://www.kijiji.ca/
What it suppose to do is fill in the Search word and then select the Search icon to query the search show the result.
String searchKeyword = "cars";
final String js = "javascript:" +
"document.getElementById('SearchKeyword').value = '" + searchKeyword + "';" +
"document.getElementById('header-button-submit').click()";
if (Build.VERSION.SDK_INT >= 19) {
view.evaluateJavascript(js, new ValueCallback<String>() {
@Override
public void onReceiveValue(String s) {
String result = s;
}
});
} else {
view.loadUrl(js);
}
Am I getting the correct id from the html doc "header-button-submit"?