我有这段代码
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加载,我无法查看源代码。谢谢。)
答案 0 :(得分:1)
ie.Document.title属性应该具有您需要的内容。 http://msdn.microsoft.com/en-us/library/ie/ms535862(v=vs.85).aspx
答案 1 :(得分: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