javascript - Unable to click button programatically in UIWebView (Webpage) -
i trying programatically click on single button on webpage in uiwebview using
nsstring *jsstat = @"document.getelementsbyname('btn btn-info') [0].click()"; [webview stringbyevaluatingjavascriptfromstring:jsstat];
but button has not been clicked programatically. button class name "btn btn-info" , button's properties are
<input type="submit" value="click me" class="btn btn-info">
and complete page is
<form action="https:www.googleabc.com"post"> <input type=hidden name=id value="myvalue" /><input type=hidden name=style value=stl:18/> <input type="submit" value="click me" class="btn btn-info">
missing here? or there better solution this?
it should getelementsbyclassname
not getelementsbyname
:
document.getelementsbyclassname('btn btn-info')[0].click()
working example:
document.getelementsbyclassname('btn btn-info')[0].click()
<input type="submit" value="click me" class="btn btn-info" onclick="console.log('clicked!')">
Comments
Post a Comment