0

我有这个代码

    Dim shellWindows = New SHDocVw.ShellWindows
    Dim strTemp As String
    For Each ie As SHDocVw.InternetExplorer In shellWindows
            If ie.LocationURL = "Http:\\somelocation" then
                    ie.Document.ExecCommand("SelectAll", True, vbNull)
                    ie.Document.ExecCommand("Copy", False, vbNull)
                    strTemp = (Clipboard.GetText())
            End if
    Next

但是,我需要知道这个 html 页面的标题。(此页面由javascript加载,我无法查看源代码。谢谢。)

4

2 回答 2

1

ie.Document.title 属性应该有你需要的。 http://msdn.microsoft.com/en-us/library/ie/ms535862(v=vs.85).aspx

于 2013-07-22T15:45:59.527 回答
0

我只是将页面作为字符串检索并找到标题:

Imports System.Net
Imports System.Text
...
    Dim myRequest As HttpWebRequest
    Dim myResponse As HttpWebResponse
....
        myRequest = CType(WebRequest.Create(URL), HttpWebRequest)
        myResponse = CType(myRequest.GetResponse(), HttpWebResponse)
        sr = New StreamReader(myResponse.GetResponseStream())
        sResponse = sr.ReadToEnd.ToString
于 2013-07-22T17:36:41.093 回答