Python WebKitWebView: how to get (generated) source code
Is it possible to get the generated source code (so including JavaScript added DOM nodes) with Python and WebKit, and if so, how?
import webkit
web_vie开发者_开发百科w = webkit.WebView()
web_view.open('http://google.com')
But then?
Bind a function to the loadFinished(bool)
signal, in that function you can use mainFrame().toHtml()
to get the source code.
I found how to do it here: http://blog.motane.lu/2009/06/18/pywebkitgtk-execute-javascript-from-python/
精彩评论