String 我想在网页中搜索特定字符串,然后使用vbs单击该url
我已经写了一个简短的脚本,导航到我想要的链接,但我无法在该网页中搜索字符串“Hello World”[请注意,我不是VBS方面的专家,如果有任何错误,请原谅],我也不知道“Hello World”指向的urlString 我想在网页中搜索特定字符串,然后使用vbs单击该url,string,search,vbscript,click,String,Search,Vbscript,Click,我已经写了一个简短的脚本,导航到我想要的链接,但我无法在该网页中搜索字符串“Hello World”[请注意,我不是VBS方面的专家,如果有任何错误,请原谅],我也不知道“Hello World”指向的url On error resume next Dim WshShell, objIE, ElementCol Dim LinkHref Dim a LinkHref = "www.abcdef.com" Set WshShell = WScript.CreateObject("WScri
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
试试这样的
For Each a In objIE.Document.GetElementsByTagName("a")
If LCase(a.href = LCase(LinkHref) Then
a.Click
Exit For
End If
Next
不清楚你在问什么。在循环中,a.InnerHTML将在anchorA中包含html注意:使用on
error resume next
是一种糟糕的编码实践!不知道它的共同点是“Hello World”将成为一个链接?