Vbscript 获取所需的错误对象:索引数组时
代码如下:Vbscript 获取所需的错误对象:索引数组时,vbscript,scope,Vbscript,Scope,代码如下: Set page = Sys.Browser("iexplore").Page... Set files_table = page.FindChildByXPath("//div[@class='dojoxGridContent']//div[@role='presentation']", True) Set files_table_rows = files_table.children row_index = 0 While Not file_found lnk_R
Set page = Sys.Browser("iexplore").Page...
Set files_table = page.FindChildByXPath("//div[@class='dojoxGridContent']//div[@role='presentation']", True)
Set files_table_rows = files_table.children
row_index = 0
While Not file_found
lnk_Refresh.Click
aqUtils.Delay(6000)
Set cell = files_table_rows(row_index) //error thrown on this line
在调试过程中,我可以看到两个对象文件\u表格
和文件\u表格\u行
,它们都是正确的,并且具有正确的数据。当我们试图获取文件\u表\u行中的第一个元素时,我们得到一个错误:
Microsoft VBScript运行时错误。
所需对象:'files\u table\u rows(…)'
如果我放置这行代码:
Set cell = files_table_rows(row_index)
就在While
循环之前,单元格设置正确。问题发生在While
循环中,我不明白为什么这是一个问题 lnk\u刷新。单击
可能会使页面无效,因此files\u table\u rows
不再指向正是@oraclecertifiedprofessional问题所在的现有对象,我必须将这些代码行移到While循环中。