I'm trying to submit a form using PyQt. I started out using it via Spynner but I've deconstructed that in my repl to just the raw PyQT calls themselves to try to debug the issue.
>>> obr.webframe.findAllElements('.qust input').toList()
[<PyQt4.QtWebKit.QWebElement object at 0xa343f7c>, <PyQt4.QtWebKit.QWebElement object at 0xa343fb4>]
>>>
>>> elem = obr.webframe.findAllElements('.qust input').toList()[1]
>>> elem.setFocus()
>>> elem.evaluateJavaScript("this.click()")
And when that didn't work, I pulled this snippet from the method in Spynner that invokes a click event, which also didn't work:
>>> jscode =
"var e = document.createEvent('MouseEvents');e.initEvent( 'click', true, true );this.dispatchEvent(e);"
>>>
>>> elem.evaluateJavaScript(jscode)
And then finally:
>>> obr.webframe.findFirstElement('form')
<PyQt4.QtWebKit.QWebElement object at 0xa34387c>
>>> obr.webframe.findFirstElement('form').evaluateJavaScript('this.submit();')
<PyQt4.QtCore.QVariant object at 0xa343f44>
>>>
In all cases, it instantly just returns. No form post is made. The form is normal:
>>> obr.webframe.findFirstElement('form').attribute('action')
PyQt4.QtCore.QString(u'SubmitPage.aspx?g=d7a717c38&ust=72a0fc7b&nm=01f00&se=53')
>>> obr.webframe.findFirstElement('form').attribute('method')
PyQt4.QtCore.QString(u'post')
If anybody has any thoughts or suggestions, I'd be SUPER appreciative. As you can see, I've been just grasping at straws here. Not my preferred debugging style...