![](/img/trans.png)
[英]How do I get the source HTML for a page after executing its associated JavaScript?
[英]How to get the source after executing javascript using Autoit
我想在IE中执行javascript后尝试获取HTML代码。 这是我的代码。
$url = "http://example.com"
$oIE = _IECreate($url)
Sleep(3000) ;waiting for executing javascript. But useless.
$oFrame = _IEFrameGetCollection($oIE, 0)
$sCode &= _IEPropertyGet($oFrame, "innerhtml") & @CRLF
然后,我得到了这个错误。
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (2308) : ==> The requested action with this object has failed.:
$oTemp = $oObject.document.body
$oTemp = $oObject^ ERROR
执行javascript后,当我在IE中查看源代码时,会出现如下HTML代码。
<html>
<head>
...
</head>
<body>
...
</body>
</html>
我该怎么办?
要阅读整个页面的源代码,请使用_IEDocReadHTML
例如
$url = "http://example.com"
$oIE = _IECreate($url)
Sleep(3000) ;waiting for executing javascript. But useless.
$sCode &= _IEDocReadHTML($oIE) & @CRLF
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.