I have successfully injected javascript into my UIWebView and successfully changed values in text fields that I wanted to using the method below. Now I want to automatize the click in the HTML Form button, but to no success, it seems the button is disabled until it receives a touch event and only on the second touch event does it submits the HTML Form, is this why the JS 'click()' method I inject does not work? How can I make it work?
The method of injection I use is described in this page
I've used this: [webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('ctl00_SPWebPartManager1_g_cb264700_1517_426f_926d_3ca40934a6fd_ctl00_EditModePanel1_btnLogin.click();');"];
And also:
[webView stringByEvaluatingJavaScriptFromString:@"var script = document.createElement('script');"
"script.type = 'text/javascript';"
"script.text = \"function x_LogBtn() { "
"var field = document.getElementById('ctl00_SPWebPartManager1_g_cb264700_1517_426f_926d_3ca40934a6fd_ctl00_EditModePanel1_btnLogin');"
"field.click();"
"}\";"
"document.getElementsByTagName('head')[0].appendChild(script);"];
[webView stringByEvaluatingJavaScriptFromString:@"x_LogBtn();"];
With no success, anyone can give me some light on the subject? Thanks!