Question

How to access DOM of a web page in QtWebKit?
I don't see any methods exposing DOM in QtWebKit...

Was it helpful?

Solution

Right now as of Qt 4.4/4.5 I don't think there are any direct way, but it's coming. See http://labs.trolltech.com/blogs/2009/04/07/qwebelement-sees-the-light-do-i-hear-a-booyakasha/

OTHER TIPS

Currently, you need to do DOM manipulation via JavaScript, injected via QVariant QWebFrame::evaluateJavaScript(const QString & scriptSource);

the DOM manipulation via javascript method is incredibly poor. for any serious usage it very quickly becomes apparent that it is completely unusable. an experiment was made to create a runtime for pyjamas-desktop using pywebkitqt4 and it utterly, utterly failed. quite a lot was achieved - such as event callbacks written in python - but they had to be set up... by creating a javascript code-snippet! this approach is truly insane. every time you want to manipulate the DOM model from python you have to go via a crap language like javascript? anybody who thinks that's a good idea is completely off their heads.

fortunately at some point in the future i will be extending pythonwebkit to allow full access to DOM functions: it will be quite easy to do this, but i just don't have the time spare at the moment to compile up webkit for qt4 (it takes 90 mins for webkit with gtk as it is).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top