0

Finding (x,y) cordinates of a text in the android UI using dtmilano Android vieClient in Monkeyrunner.

i am getting only relative cordinates using below code:-

vc = ViewClient(devid,deviceid)
dump=vc.dump()
peer_pos = vc.findViewWithAttribute('text:mText',peer_name)
x, y) = peer_pos.getXY()

The (x,y) returning is not correct always.How to find out the real coordinates.somebody please help.

Rilwan
  • 2,251
  • 2
  • 19
  • 28

1 Answers1

1

Have you looked at the guide here? It provides an introduction to using ViewClient with MonkeyRunner and might be helpful.

n8schloss
  • 2,723
  • 2
  • 19
  • 27
  • I got the idea from the above blog only,but the co-ordinates returning by getXY() is relative to its parent,Not the real coordinates.It will be really helpful if someone can give a idea about ,traversing to the real coordinate. – Rilwan Jun 27 '12 at 10:23
  • What exactly are you trying to do with the coordinates. Because it looks like you could do `peer_pos.touch()` if you were trying to touch that spot. You might also want to look at the code for ViewClient to see what it's doing when you run the touch method on an object. In order to touch the right spot it would need to be using the actual x,y coordinates. – n8schloss Jun 27 '12 at 17:48