VBScript遇到getElementsbyTagName问题

时间:2014-09-12 19:22:27

标签: internet-explorer dom web-applications vbscript

我试图通过搜索内部文本在DOM中找到一个锚标记,然后模拟一个点击链接,该链接具有与特定文本字符串匹配的内部文本。我试过以下

Option Explicit

Dim objIE : Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "http://myURL"
objIE.Visible = True

WScript.Sleep 10000

' loop through links
Dim anchor
For Each anchor in objIE.document.getElementsByTagName("a")
  ' check text for link
  If InStr(UCase(anchor.innerText), "DOCUMENT LIST") > 0 Then
    ' navigate to the first match and exit the for...next loop
    anchor.Click
    Exit For
  End If
Next  

此脚本将Internet Explorer打开到正确的页面,但我在

时收到错误消息
For Each anchor in objIE.document.getElementsByTagName("a")

The interface is unknown

我觉得问题与一旦Web应用程序打开,URL更改这一事实有关,尽管显示仍然相同。

非常感谢任何帮助。

0 个答案:

没有答案