开发者

Python WebKitWebView: how to get (generated) source code

开发者 https://www.devze.com 2023-03-10 14:14 出处:网络
Is it possible to get the generated source code (so including JavaScript added DOM nodes) with Python and WebKit, and if so, how?

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号