0

I have x = 402 and y=201 I need to get text available at that specified coordinates using Androidviewclient can anyone help in solving this issue

1 Answers1

0

ViewClient.findViewsContainingPoint() method does exactly that, given a Point returns the list of Views containing such Point, which could be more than one.

Then, you can get the text or any other View attribute.

culebra can create a template script for you and then you can edit it and add what you need.

For your case something like this

def testSomething(self):
    if not self.preconditions():
        self.fail('Preconditions failed')

    _s = CulebraTests.sleep
    _v = CulebraTests.verbose

    self.vc.dump(window=-1)
    views = self.vc.findViewsContainingPoint((402,201))
    for v in views:
        print(v)
Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • Here is my Code b = vc.findViewsContainingPoint(402,201,) print (b) Error :- Traceback (most recent call last): File "C:\Users\mobis\Desktop\keypress.py", line 16, in b = vc.findViewsContainingPoint(402,201,) File "C:\Python27\lib\site-packages\com\dtmilano\android\viewclient.py", line 3781, in findViewsContainingPoint def findViewsContainingPoint(self, (x, y), _filter=None): TypeError: 'int' object is not iterable – Raghu vamshi Mandala Sep 27 '18 at 03:54
  • Here is my complete code import sys import os import time try: sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src')) except: pass from com.dtmilano.android.viewclient import ViewClient device, serialno = ViewClient.connectToDeviceOrExit() vc = ViewClient(device, serialno) b = vc.findViewsContainingPoint(402,201) print (b) – Raghu vamshi Mandala Sep 27 '18 at 04:38