我正在使用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返回一般错误的各种其他组合。
I am using UFT and VBS and I am getting an object from a JavaScript command that returns other objects, but I am unable to access these objects properties.
In detail:
I run in UFT a command that returns all the data from a SlickGrid table. The command is grid.getData(); and returns an object. This object is set to object variable objListArray and the hierarchy is: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
No matter what I tried I cannot access the properties of the objects. Any ideas how I can access these properties? I am limited to VBS as this is for a UFT script.
So far I tried without success:
objListArray(0).Property1 '--> Generic error For Each x in objListArray '--> Object does not support thatvarious other combinations that return a generic error.
最满意答案
在UFT中访问JavaScript数组时出现问题,请参阅我对另一个问题的回答 。
我似乎记得UFT已经解决了问题,所以尝试使用.item ,如果这不起作用,你可以尝试我前面提到的答案的建议。
I realized that the object is of type JScriptTypeInfo
In order to access it I can use the bellow:
objListArray.[0].Property1Now, to iterate through the Object you can do it like that:
For i = 0 To objListArray.Length-1 x = eval("objListArray.[" & index & "].[Account Number]") 'Do anything you want with x Next更多推荐
发布评论