onload javascript 后 HTML 的状态 [英] state of HTML after onload javascript

查看:41
本文介绍了onload javascript 后 HTML 的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

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

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?

理想情况下,我需要一个可以与 Python 交互的解决方案.

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

谢谢!

推荐答案

我知道做这些事情的唯一好方法是自动化浏览器,例如通过 Selenium RC.如果您不知道如何推断该页面已完成相关 javascript 的运行,那么,作为访问该页面的真实用户,您只需稍等片刻,抓一张快照,再等一会儿,再抓一张,并检查他们之间没有任何变化,以说服自己它真的完成了.

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.

这篇关于onload javascript 后 HTML 的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆