class WebPage(QtWebKit.QWebPage):

    def javaScriptConsoleMessage(self, msg, line, source):
        print('%s line %d: %s' % (source, line, msg))
url = 'http://localhost/test.html'
app = QtGui.QApplication([])
browser = QtWebKit.QWebView()
page = WebPage()
browser.setPage(page)
browser.load(QtCore.QUrl(url))
browser.show()
sys.exit(app.exec_())
Печать исключений Javascript в QWebView на консоли