How can I get text if I have x,y coordinates using Androidviewclient

258 Views Asked by At

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

There are 1 best solutions below

2
On BEST ANSWER

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)