I created an app with Webview and need to press button automatically
Use case:- open link web link and want to press "Login Here" button automatically (Second button at right).
I tried Using this:-
Html from website for "Login Here" button was <input _ngcontent-c13="" style="padding: 2px" type="button" class="pri_btn" value="Login Here"> It does not have id or name so i tried with class name but nothing happened
String js = "javascript:(function(){"+
"l=document.getElementByClassName('pri_btn');"+
"e=document.createEvent('HTMLEvents');"+
"e.initEvent('click',true,true);"+
"l.dispatchEvent(e);"+
"})()";
webView.evaluateJavascript(js, new ValueCallback<String>() {
@Override
public void onReceiveValue(String s) {
String result = s;
}
});
which return null.
Any help will be appreciated!
from Click button automatically in webview?
No comments:
Post a Comment