在internet explorer中打开新选项卡并使用vb.net获取其源代码
是否有办法在已打开的internet explorer窗口中打开新选项卡并获取其源代码?我找到的大部分信息包括创建一个新的Internetexplorer对象。当我打开internet explorer的新实例以打开网站时,我尝试访问的安全网页不喜欢它。因此,我想在已经打开的internet explorer窗口上打开一个新选项卡,以避免安全性/cookie问题。我最终尝试获取网站的源代码并从中提取超链接。下面是我到目前为止的想法。如有任何建议,将不胜感激在internet explorer中打开新选项卡并使用vb.net获取其源代码,vb.net,internet-explorer,vba,tabs,Vb.net,Internet Explorer,Vba,Tabs,是否有办法在已打开的internet explorer窗口中打开新选项卡并获取其源代码?我找到的大部分信息包括创建一个新的Internetexplorer对象。当我打开internet explorer的新实例以打开网站时,我尝试访问的安全网页不喜欢它。因此,我想在已经打开的internet explorer窗口上打开一个新选项卡,以避免安全性/cookie问题。我最终尝试获取网站的源代码并从中提取超链接。下面是我到目前为止的想法。如有任何建议,将不胜感激 Private Sub Button1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Standard module code, like: Module1.
Dim ie As Object, objDoc As Object
Const strURI As String = "http://www.cnn.com"
ie = CreateObject("internetexplorer.application")
ie.Navigate(strURI)
'Wait for page to load!
Do
If ie.ReadyState = 4 Then
ie.Visible = True
Exit Do
Else
Application.DoEvents()
End If
Loop
objDoc = ie.Document
Dim strMyPage As String
strMyPage = objDoc.body.innerHTML
TextBox1.Text = strMyPage
objDoc = Nothing
ie = Nothing
End Sub
你可以用它来达到这个目的
为了获取打开选项卡的源代码,需要使用WM_GETOBJECT获取现有文档的IHTMLDocument2接口,然后可以枚举该文档中的锚对象
显示了一般模式