如何在QtWebKit中访问网页的DOM?

发布于 2024-07-29 03:10:46 字数 66 浏览 11 评论 0原文

如何在QtWebKit中访问网页的DOM?
我没有看到任何在 QtWebKit 中公开 DOM 的方法...

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怪我闹别瞎闹 2024-08-05 03:10:46

目前,您需要通过 JavaScript 进行 DOM 操作,通过注入
QVariant QWebFrame::evaluateJavaScript(const QString & scriptSource);

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

强者自强 2024-08-05 03:10:46

目前,从 Qt 4.4/4.5 开始,我认为没有任何直接的方法,但它即将到来。 请参阅 http://labs.trolltech.com/blogs/2009/04/07/qwebelement-sees-the-light-do-i-hear-a-booyakasha/

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/

一桥轻雨一伞开 2024-08-05 03:10:46

通过 javascript 方法进行 DOM 操作非常糟糕。 对于任何严重的使用,很快就会发现它完全无法使用。 我们曾尝试使用 pywebkitqt4 创建 pyjamas-desktop 的运行时,但它彻底失败了。 已经实现了很多东西 - 例如用 python 编写的事件回调 - 但必须通过创建 javascript 代码片段来设置它们! 这种做法确实很疯狂。 每次你想通过 python 操作 DOM 模型时,你都必须使用像 javascript 这样的垃圾语言吗? 任何认为这是个好主意的人都完全疯了。

幸运的是,在未来的某个时候,我将扩展 pythonwebkit 以允许完全访问 DOM 函数:这将很容易做到这一点,但我现在没有时间为 qt4 编译 webkit (它对于 webkit 和 gtk 来说需要 90 分钟)。

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文