高难问题:webbrwoser取得网页frame中的内容
2066 2004-01-03 04:30:57 第一步,取得网页源代码:
webbrowser.Navigate("http://wxfc.xilubbs.com/")
while webbrowser.busy
Aplication.Doevents()
end while
msgbox(webbrowser.Document.all.tags("html").item(0).outerhtml)
得到如下代码:
<HTML><HEAD><TITLE></TITLE>
<SCRIPT language=JavaScript>
window.open('ads.html','ads','width=350,height=220');
</SCRIPT>
</HEAD><FRAMESET border=0 frameSpacing=0 rows=100%,* frameBorder=0><FRAME name=easymain marginWidth=10 marginHeight=5 src="http://bbs.xilubbs.com/cgi-bin/bbs/bbs?forum=wxfc"></FRAMESET></HTML>
看到出这是个框架网页
第二步,取框架中的内容
取第一个框架页body中的内容
msgbox(webbrowser.Document.all.frames(0).document.body.outerhtml)
在这里却产生错误.注意,我在别的网站(非xilu)中,应用此代码不会产生错误.会不是因为这里的src为绝对地址?
错误提示:
未处理的"System MissingMemberException" 类型的异常出现在Microsoft.Visualbasic.dll" 中,
其他信息:未找到"DispHtmlElementCollection"的公共成员
再试
msgbox(webbrowser.Document.all.frames("easymain").document.body.outerhtml)
仍旧错误,