51Testing软件测试论坛

标题: Java Tree Click???? [打印本页]

作者: waferguy    时间: 2005-4-29 12:30
标题: Java Tree Click????
I'm facing problem with Java Tree, when use method click in with object as below

objTree.JavaTree("JTree").Click 124,132,"RIGHT"

But I don't know the value [124, 132] where they come from & how do we know this value?
Do have another ways to create the right click action on specific item in Java Tree?
Thnks for advance
作者: QA_BAY    时间: 2005-4-29 13:04
你可以用QTP的SPY
她可以查出你的X  AND Y 坐标是多少!
作者: waferguy    时间: 2005-4-29 14:14
Thnks for your help
But I think this way only apply for design time. how about this x, y at runtime?

Ex: I have flow action

Step1: Add new node A into tree
Step2: Select node A & right click -> popup a context menu
Step3: Select [Delete] menu item in context menu -> The node A will be delete
作者: QA_BAY    时间: 2005-4-29 15:17
x y 是WINDOWS的坐标.当你的菜单改变时,录制的坐标也会跟着改变,
所以你只能用QTP的SPY来辨认X Y坐标!
好像没有其它的方法!
不知道我的理解有没有问题!
作者: yuxingxin    时间: 2005-4-29 15:59
objTree.JavaTree("JTree").Click 124,132,"RIGHT"
这个RIGHT是什么意思?
124,132应该是相对坐标。
作者: QA_BAY    时间: 2005-4-29 17:02
应该是右键吧!
作者: waferguy    时间: 2005-4-29 18:14
objTree.JavaTree("JTree").Click 124,132,"RIGHT"

This code mean right click at position (124, 132)
作者: ziheng198688    时间: 2008-11-7 09:56
我认为可以省去x,y,直接修改为objTree.JavaTree("JTree").Click ,,"RIGHT"
作者: bertha2124    时间: 2008-11-7 11:33
不知道是不是您要的,请参考一下:
因为直接录制,取得的是座标,所以反过来,
先设定好我要取的节点,让他去计算x, y.
其中node包含父节点和子节点,意思是说如果是A下面有B, 则node = "A:B" 。

Call RightClick(TestWin,TestJTree, TestJNode)

'下面是function,为了取得该node的 x, y座标。

Public Function RightClick(JWin,JTree, Node)

JWin,JTree.Select Node

set selectionPath = JWin.JTree.Object.getSelectionPath()

set rect = JWin.JTree.Object.getPathBounds(selectionPath)

x = rect.x

y = rect.y

JWin.JTree.Click CStr(x), CStr(y), "RIGHT"

End Function

參考:AdvancedQTP Forum
作者: lingxin5013    时间: 2008-11-7 16:06
I can answer the question which you vote for.
the market X,Y means the postion relative for the howle Windows .
the Abs_X or Abs_Y  is ablolute market on you application.
pay attention it on you application's market.




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2