高难问题: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)
仍旧错误,





...全文
183 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
2066 2004-04-11
  • 打赏
  • 举报
回复
<form name="inform" action="register2" method="post" >
  <input name="nickname" value="ashg56">
  <input type="password" name="passwd" value="" >
  <input type="password" name="repasswd" value="" >
  <input name="age" value="0">
  <input type="text" name="year" value="" >

<select name="month">
  <option value="0">/月</option>
  <option value="1">01</option
</select>

<select name="day">
<option value="0">/日</option>
<option value="1">01</option>
</select>

<input type="text" name="email" value="" >
<input type="text" name="prompt" value="我最好的朋友是?">
<input type="text" name="answer" >
<input type="submit" value=" 提 交 " name="submit2">
<input type="reset" value="重新填写" name="reset2">
<input name="method" value="">
</form>

2066 2004-04-11
  • 打赏
  • 举报
回复
<form action="register" method="post">
  <input name="nickname" value="ashg56">
  <input name="allow" value="y">
  <input type="submit" name="" value="我同意">  
<input type="button" name="reject" value="不同意" >
</form>
2066 2004-04-11
  • 打赏
  • 举报
回复
<form name="form1" action="register" method="post" >
<input type="text" name="nickname" >
<input type="submit" name="Submit" value=" => 继续 > </form>
8620 2004-01-10
  • 打赏
  • 举报
回复
有两个问题:
1.webbrowser.Document.all.frames("easymain").document.body.outerhtml
去掉all,改成
webbrowser.Document.frames("easymain").document.body.outerhtml

2.先取得frame的地址
Dim a As mshtml.HTMLDocumentClass = CType(WebBrowser.Document, mshtml.HTMLDocumentClass)
'子窗体easymain的url:
dim url as string=a.getElementsByName("easymain").item.src.tostring

'再:
webbrowser.Navigate(url)
while webbrowser.busy
Aplication.Doevents()
end while

msgbox(webbrowser.Document.frames("easymain").document.body.outerhtml)
ksy 2004-01-09
  • 打赏
  • 举报
回复
'webbrowser.Document属于:mshtml.HTMLDocumentClass类.
'要使用这个类必须添加对组件Microsoft.mshtml的引用.强制转换为该类在vs.net环境下可以方便看到它的属性和方法:
Dim a As mshtml.HTMLDocumentClass = CType(WebBrowser.Document, mshtml.HTMLDocumentClass)
'子窗体easymain的url:
a.getElementsByName("easymain").item.src.tostring
2066 2004-01-09
  • 打赏
  • 举报
回复
up
不朽之王 2004-01-07
  • 打赏
  • 举报
回复
up
8620 2004-01-07
  • 打赏
  • 举报
回复
up
2066 2004-01-06
  • 打赏
  • 举报
回复
up
2066 2004-01-04
  • 打赏
  • 举报
回复
高难问题难倒高手了吗?
8620 2004-01-04
  • 打赏
  • 举报
回复
up
斗斗来三 2004-01-03
  • 打赏
  • 举报
回复
帮你顶

16,721

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧