I had a similar issue and unfortunately I have discovered that there is a bug in the Centos package as far as I can tell. I have run a comparison of the contents of all distributions for that version and they do not match. I will wait for an update of Centos that seems to be a bit behind other distributions.
QWebFrame object has no attribute documentElement
Question
My code:
import sys
import time
from PyQt4.QtGui import QApplication
from PyQt4.QtCore import QUrl
from PyQt4.QtWebKit import *
class Browser(QWebView):
def __init__(self):
QWebView.__init__(self)
self.loadFinished.connect(self._result_available)
def _result_available(self, ok):
doc = self.page().mainFrame().documentElement()
[...]
if __name__ == '__main__':
app = QApplication(sys.argv)
view = Browser()
view.load(QUrl('http://www.example.net/'))
app.exec_()
For some reason I get this error and I cannot figure it out why. I have updated to the latest qtwebkit version and still I get this. The QT manual said it was implemented in version 4.6 and I have qt version 4.6.2-26.el6_4.
I get the following error from the above code.
Traceback (most recent call last):
File "web.py", line 15, in _result_available
doc = self.page().mainFrame().documentElement()
AttributeError: 'QWebFrame' object has no attribute 'documentElement'
P.S. I also get this error since upgrading from qtwebkit version 2.0-3.el6 to 2.1.1-1.el6:
can't make "generic.orientation" because no QAccelerometer sensors exist
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow