Skip to content

Instantly share code, notes, and snippets.

@juanriaza
Created May 6, 2012 19:40
Show Gist options
  • Save juanriaza/2624047 to your computer and use it in GitHub Desktop.
Save juanriaza/2624047 to your computer and use it in GitHub Desktop.
import sys
from PySide.QtGui import *
from PySide.QtCore import *
from PySide.QtWebKit import *
class RenderJavaScript(QWebPage):
def __init__(self, url):
self.app = QApplication(sys.argv)
QWebPage.__init__(self)
self.loadFinished.connect(self._loadFinished)
self.mainFrame().load(QUrl(url))
self.app.exec_()
def _loadFinished(self, result):
self.frame = self.mainFrame()
self.app.quit()
r = RenderJavaScript('http://www.google.co.uk')
html = r.frame.toHtml()
print html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment