waferguy 发表于 2005-4-29 12:30:41

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 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:44

你可以用QTP的SPY
她可以查出你的XAND Y 坐标是多少!

waferguy 发表于 2005-4-29 14:14:20

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 menu item in context menu -> The node A will be delete

QA_BAY 发表于 2005-4-29 15:17:19

x y 是WINDOWS的坐标.当你的菜单改变时,录制的坐标也会跟着改变,
所以你只能用QTP的SPY来辨认X Y坐标!
好像没有其它的方法!
不知道我的理解有没有问题!

yuxingxin 发表于 2005-4-29 15:59:40

objTree.JavaTree("JTree").Click 124,132,"RIGHT"
这个RIGHT是什么意思?
124,132应该是相对坐标。

QA_BAY 发表于 2005-4-29 17:02:50

应该是右键吧!

waferguy 发表于 2005-4-29 18:14:23

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

This code mean right click at position (124, 132)

ziheng198688 发表于 2008-11-7 09:56:52

我认为可以省去x,y,直接修改为objTree.JavaTree("JTree").Click ,,"RIGHT"

bertha2124 发表于 2008-11-7 11:33:59

不知道是不是您要的,请参考一下:
因为直接录制,取得的是座标,所以反过来,
先设定好我要取的节点,让他去计算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:03

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_Yis ablolute market on you application.
pay attention it on you application's market.
页: [1]
查看完整版本: Java Tree Click????