onload javascript 后 HTML 的状态

发布于 2024-08-04 21:53:10 字数 195 浏览 5 评论 0原文

许多网页使用 onload JavaScript 来操作它们的 DOM。有没有办法可以在这些 JavaScript 操作之后自动访问 HTML 的状态?

像 wget 这样的工具在这里没有用,因为它只是下载原始源。 有没有办法使用网络浏览器渲染引擎?

理想情况下,我想要一个可以通过 Python 进行交互的解决方案。

谢谢!

many webpages use onload JavaScript to manipulate their DOM. Is there a way I can automate accessing the state of the HTML after these JavaScript operations?

A took like wget is not useful here because it just downloads the original source.
Is there perhaps a way to use a web browser rendering engine?

Ideally I am after a solution that I can interface with from Python.

thanks!

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

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

发布评论

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

评论(2

木格 2024-08-11 21:53:10

The only good way I know to do such things is to automate a browser, for example via Selenium RC. If you have no idea of how to deduce that the page has finished running the relevant javascript, then, just a real live user visiting that page, you'll just have to wait a while, grab a snapshot, wait some more, grab another, and check there was no change between them to convince yourself that it's really finished.

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