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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -