WebBrowser1.DocumentText [英] WebBrowser1.DocumentText

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

问题描述

我怎样才能获取框架的html源?


我可以通过WebBrowser1.DocumentText来回溯主框架

但是我想要追溯内部(孩子) )框架......


WebBrowser1.Document.Window.Frames(0).DocumentText之类的东西不存在......

How can I grab html source of a frame?

I can retrive main frame by WebBrowser1.DocumentText
but I want to retrive inner (child) frame...

WebBrowser1.Document.Window.Frames(0).DocumentText like thing doesn''t exist...

推荐答案

Nime,


你在这个新闻组中排名第三。在我的想法中你不能用新的webbrowser(它缺少downloadcomplete)来实现

。你可以用Axwebbrowser做到这一点

。如果您只想获得一个带有

自己的URL的特殊框架,那么您也可以使用这个

http://www.vb-tips.com/dbPages.aspx?... f-56dbb63fdf1c


我希望这会有所帮助,


Cor



nime < ea **** @ planev.comschreef in bericht

news:eU ************** @ TK2MSFTNGP02.phx.gbl ...
Nime,

You are number three asking this in this newsgroup. In my idea you cannot do
that with the new webbrowser (it is missing downloadcomplete). You can do it
with the Axwebbrowser. If you only want to get one special frame with its
own URL, than you can as well use this

http://www.vb-tips.com/dbPages.aspx?...f-56dbb63fdf1c

I hope this helps,

Cor


"nime" <ea****@planev.comschreef in bericht
news:eU**************@TK2MSFTNGP02.phx.gbl...

如何获取框架的html源?


我可以通过WebBrowser1.DocumentText来回溯主框架

但是我想要回溯内部(子)框架...


WebBrowser1.Document.Window.Frames(0).DocumentText就像没有什么

存在...


How can I grab html source of a frame?

I can retrive main frame by WebBrowser1.DocumentText
but I want to retrive inner (child) frame...

WebBrowser1.Document.Window.Frames(0).DocumentText like thing doesn''t
exist...




On Sun,2006年7月2日02:18:48 + 0300,nime < ea **** @ planev.comwrote:
On Sun, 2 Jul 2006 02:18:48 +0300, "nime" <ea****@planev.comwrote:

>我如何获取框架的html源?

我可以通过WebBrowser1.DocumentText检索主框架
但我想要检索内部(子)框架......

WebBrowser1.Document.Window.Frames(0).DocumentTex t like thing doesn''存在...

>How can I grab html source of a frame?

I can retrive main frame by WebBrowser1.DocumentText
but I want to retrive inner (child) frame...

WebBrowser1.Document.Window.Frames(0).DocumentTex t like thing doesn''t exist...



看看这是否有帮助:


Private LinksTable As Hashtable


Private Sub WebBrowser1_DocumentCompleted(ByVal _

sender As Object,ByVal e As _

System.Windows.Forms.WebBrowserDocumentCompletedEv entArgs)_

处理WebBrowser1.DocumentCompleted


GetLinksFromFrames()


结束子


Private Sub GetLinksFromFrames()

LinksTable = New Hashtable()

Dim FrameUrl As String


If(Not WebBrowser1.Document什么都没有)然后

使用WebBrowser1.Document

Dim CurrentWindow作为HtmlWi ndow = .Window

if(CurrentWindow.Frames.Count 0)然后

为每个帧作为HtmlWindow在_

Frame.Document.Links

FrameUrl = Frame.Url.ToString()


Dim ThisFrameName As String = Frame.Name

Dim ThisFrameDocument As _

HtmlDocument = Frame.Document


Dim FrameLinksHash As New Hashtable()

LinksTable.Add(FrameUrl,FrameLinksHash)


每个HrefElement作为HtmlElement在_

Frame.Document.Links

FrameLinksHash.Add(HrefElement.GetAttribute _

(HREF),Url)

下一页

下一页

否则

Dim DocLinksHash As New Hashtable()

LinksTable.Add(。Urr.ToString(),DocLinksHash)


每个HrefElement为HtmlElement In .Links

DocLinksHash.Add(HrefElement.GetAttribute _

(" HREF")," Url")

下一页

结束如果

结束

结束如果

End Sub

Gene

See if this helps:

Private LinksTable As Hashtable

Private Sub WebBrowser1_DocumentCompleted(ByVal _
sender As Object, ByVal e As _
System.Windows.Forms.WebBrowserDocumentCompletedEv entArgs) _
Handles WebBrowser1.DocumentCompleted

GetLinksFromFrames()

End Sub

Private Sub GetLinksFromFrames()
LinksTable = New Hashtable()
Dim FrameUrl As String

If (Not WebBrowser1.Document Is Nothing) Then
With WebBrowser1.Document
Dim CurrentWindow As HtmlWindow = .Window
If (CurrentWindow.Frames.Count 0) Then
For Each Frame As HtmlWindow In _
Frame.Document.Links
FrameUrl = Frame.Url.ToString()

Dim ThisFrameName As String = Frame.Name
Dim ThisFrameDocument As _
HtmlDocument = Frame.Document

Dim FrameLinksHash As New Hashtable()
LinksTable.Add(FrameUrl, FrameLinksHash)

For Each HrefElement As HtmlElement In _
Frame.Document.Links
FrameLinksHash.Add(HrefElement.GetAttribute _
("HREF"), "Url")
Next
Next
Else
Dim DocLinksHash As New Hashtable()
LinksTable.Add(.Url.ToString(), DocLinksHash)

For Each HrefElement As HtmlElement In .Links
DocLinksHash.Add(HrefElement.GetAttribute _
("HREF"), "Url")
Next
End If
End With
End If
End Sub
Gene


" nime" < ea **** @ planev.comschrieb:
"nime" <ea****@planev.comschrieb:

如何获取框架的html源?


我可以通过WebBrowser1.DocumentText来回溯主框架

但我想要检索内部(子)框架...


WebBrowser1.Document.Window.Frames( 0).DocumentText就好像不存在
存在...
How can I grab html source of a frame?

I can retrive main frame by WebBrowser1.DocumentText
but I want to retrive inner (child) frame...

WebBrowser1.Document.Window.Frames(0).DocumentText like thing doesn''t
exist...



\\\
$ b每个帧的$ b为HtmlWindow在Me.WebBrowser1.Document.Window.Frames

MsgBox(Frame.Document.All(1).OuterHtml)

Next Frame

///


-

MS Herfried K. Wagner

MVP< URL:http ://dotnet.mvps.org/>

VB< URL:http://classicvb.org/petition/>

\\\
For Each Frame As HtmlWindow In Me.WebBrowser1.Document.Window.Frames
MsgBox(Frame.Document.All(1).OuterHtml)
Next Frame
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


这篇关于WebBrowser1.DocumentText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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