Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

swing - 如何在VB脚本中将对象(Java Swing对象)分配给变量?(How should I assign the objects (Java Swing Objects) to the variables in VB Script?)

I use a test automation tool called Test Complete with VB script(mainly) and Java Script, we have af/w where we have an objects repository and then a layer of actions on these objects and finally a top test case layer.

(我使用一个称为Test Complete的测试自动化工具,主要使用VB脚本和Java Script,我们在af / w那里有一个对象存储库,然后有一个对这些对象进行操作的层,最后是顶层测试用例层。)

We have a Java Swing as our AUT and we stored the objects of AUT with its complete hierarchy as we're not using a feature called NameMapping of the tool.

(我们有一个Java Swing作为我们的AUT,由于我们没有使用该工具的NameMapping功能,因此我们以完整的层次结构存储了AUT的对象。)

The structure is doing well but we see usual maintenance, so wanted to try something to reduce it.

(该结构运行良好,但是我们看到了通常的维护,因此想尝试一些减少它的方法。)

Maintenance is about the object changes as the solution is getting readied yet.

(维护与对象更改有关,因为解决方案已准备就绪。)

I have an idea to reduce that maintenance but I am stuck.

(我有一个减少维护的想法,但是我被困住了。)

So question is, can i assign individual Swing object to the variables in Vb Script ?

(所以问题是,我可以将单个Swing对象分配给Vb脚本中的变量吗?)

For example:

(例如:)

Dim Window = SwingObject("WindowName","some property")

(昏暗的窗口= SwingObject(“ WindowName”,“某些属性”))

Dim Process= Process("xyz")

(Dim Process = Process(“ xyz”))

Dim Btn = SwingObject("Jbutton", "Id")

(Dim Btn = SwingObject(“ Jbutton”,“ Id”))

When I tried above examples, I got error but when I use a bit of object hierarchy then all seems to work fine.I want to assign the objects to variables individually like I mentioned above in the example not like below:

(当我尝试上述示例时,我遇到了错误,但是当我使用一些对象层次结构时,一切似乎都正常工作。我想像上面示例中提到的那样将对象分别分配给变量,如下所示:)

Dim Window= Sys.Process("xyz").SwingObject("WindowName","some property")

(昏暗的窗口= Sys.Process(“ xyz”)。SwingObject(“ WindowName”,“某些属性”))

Dim Process= Sys.Process("xyz") [I can still manage with Process assignment like this]

(Dim Process = Sys.Process(“ xyz”)[我仍然可以通过这样的流程分配进行管理])

Any help is greatly appreciated.

(任何帮助是极大的赞赏。)

Thanks Yogesh

(谢谢Yogesh)

  ask by Yogesh translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...