我正在使用 UFT 和 VBS,我从返回其他对象的 JavaScript 命令获取一个对象,但我无法访问这些对象属性。
详细说明:
- 我在 UFT 中运行一条命令,该命令返回
SlickGrid
表中的所有数据。命令是grid.getData();
并返回一个对象。 - 此对象设置为对象变量
objListArray
,层次结构为:
objListArray (Object) | |---0 (Object) | | | |---Property1 : Value | |---Property2 : Value | |---Propertyx : Value | |---1 (Object) | | | |---Property1 : Value | |---Property2 : Value | |---Propertyx : Value | |---2 (Object) | | | |---Property1 : Value | |---Property2 : Value | |---Propertyx : Value | |---n (Object) | |---Property1 : Value |---Property2 : Value |---Propertyx : Value
无论我尝试什么,我都无法访问对象的属性。 有什么想法可以访问这些属性吗?我仅限于 VBS,因为这是针对 UFT 脚本的。
到目前为止我试过没有成功:
objListArray(0).Property1 '--> Generic error
For Each x in objListArray '--> Object does not support that
返回一般错误的各种其他组合。
最佳答案
在 UFT 中访问 JavaScript 数组时出现问题,请参阅 my answer to another such question .
我似乎记得 UFT 自己解决了这个问题,所以尝试使用 .item
,如果这不起作用,您可以尝试我上述答案中的建议。
关于javascript - 访问驻留在另一个对象中的对象的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32525053/