我设法编写了一个短脚本导航到我想要的链接,但是我无法在该网页中搜索字符串“Hello World”[请注意,我不是VBS中的任何专家,如果有任何错误,请原谅]我不知道“Hello World”引导的网址。
On error resume next
Dim WshShell, objIE, ElementCol
Dim LinkHref
Dim a
LinkHref = "www.abcdef.com"
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = False
objIE.Navigate LinkHref
wshShell.AppActivate objIE
Do While objIE.Busy
wscript.sleep 6000
Loop
LinkHref = "Hello World"
For Each a In objIE.Document.GetElementsByTagName("A")
If LCase(a.GetAttribute("href")) = LCase(LinkHref) Then
a.Click
Exit For
End If
Next
objIE.Visible = True
答案 0 :(得分:0)
尝试这样的事情
For Each a In objIE.Document.GetElementsByTagName("a")
If LCase(a.href = LCase(LinkHref) Then
a.Click
Exit For
End If
Next