How To Open Web Page And Click On Element?
I'm building an app on Android, and I want it when I press any button in the application It will open a web page and enter Text TextBox and click the button On this web page automa
Solution 1:
thank's for help, I try to input text 'java help' in google search and then click button search, and it's not work.
I download "inspect html" in the android device and get from there the name class of the elements of the input text and button of google search page.
this is the code:
publicvoidonClick(View view) {
WebViewwebView= (WebView) findViewById(R.id.webView1);
webView.setWebViewClient(newWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://www.google.co.il/?hl=iw");
webView.loadUrl("javascript:(function() { document.getElementsByClassName('gLFyf').value = 'java help';})()");
webView.loadUrl("javascript:(function() { var z = document.getElementsByClassName('Tg7LZd').click(); })()");
}
thank's shani
Post a Comment for "How To Open Web Page And Click On Element?"