''' I know this is meant for pyqt but I've had little luck this that board.
The short answer is yes, but it's a total hack...and I'm wondering if anybody has a more elegant solution. Specifically I would like to be able to fire a defer from the javascript instead of having to call alert. Below is an example of how I currently gain access...not necessarily a working version. ''' url = 'http://www.google.com' mo = """ var observer = new MutationObserver(function(mutations) { for (var x = 0; x < mutations.length; x++) { if (mutations[x].addedNodes.length > 0) { alert('add nodes') } } }); var config = { attributes: true, childList: true, characterData: false } var nti = document.querySelector('document.body') observer.observe(nti, config); """ page = QWebPage() def alarmAction(qframe, msg): print 'deferred action', qframe, msg def mutationHook(): d = defer.Deferred() d.addCallback(alarmAction) page.javaScriptAlert = d.callback page.mainFrame().documentElement().evaluateJavaScript(mo) page.loadFinished(mutationHook) page.mainFrame().setUrl(url)
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python