How can I perform click on WebView from java code? Is it possible to click on a specified location (x,y)?
WebView.performClick()
doesn't work!
You can do this by injecting javascript to your webview using loadUrl():
mWebView.loadUrl("javascript:<your javascript here>");
This example code will perform a click on the element with id 'button_submit':
mWebView = new WebView(context);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("javascript:getElementById('button_submit').click();");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With