简体   繁体   English

UFT / QTP:在Java Internal Frame中计数子对象

[英]UFT/QTP: Count child objects in Java Internal Frame

I need to compare a string with all values of my text fields that are inside in a Java Internal Frame. 我需要将字符串与Java Internal Frame中的文本字段的所有值进行比较。

I already tried to use this code: 我已经尝试使用此代码:

Dim getElement
Set getElement = Description.Create
getElement("class description").value = "text box"

'I tried different class names: "OracleTextField", "JavaEdit"    
'getElement("micclass").value = "OracleTextField"
'getElement("micclass").value = "JavaEdit"

Set obj = Browser("xxxx").JavaApplet("Main").JavaInternalFrame("yyyy").ChildObjects(getElement)

total = obj.Count

' For loop goes here

total returns 0 all the time. total始终返回0。

Can you tell me what I'm doing wrong? 你能告诉我我做错了吗? If you need something more let me know. 如果您还需要其他信息,请告诉我。

I tried the following line and it works. 我尝试了以下行,它可以工作。 Now i have total number of text fields available in Java internal frame. 现在,我在Java内部框架中可以使用的文本字段总数。

getElement("to_class").value = "JavaEdit"

Following QTP documentation didn't help, but if you check your object properties inside your Object Repository you'll find all properties of each object. 遵循QTP文档无济于事,但是如果您检查对象存储库中的对象属性,则会找到每个对象的所有属性。 Instead of "micclass" try to use your property name. 尝试使用您的属性名称,而不是“ micclass”。 Mine was "to_class" with value "JavaEdit". 我的是“ to_class”,值“ JavaEdit”。

QTP Documentation explains why we should use "micclass" and differences between "micclass" and "Class Name". QTP文档解释了为什么我们应该使用“ micclass”以及“ micclass”和“ Class Name”之间的区别。 However none of them worked for me. 但是他们都没有为我工作。 I used "to_class" property and it works fine! 我使用了“ to_class”属性,效果很好!

I'm working with UFT v12.02 我正在使用UFT v12.02

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM