Auto click on WebView
How can I perform click on WebView from java code? Is it possible to click on a s开发者_C百科pecified 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();");
精彩评论