(Edit: the following problem only seems to occur on my Samsung S10e. I just got home and tried Android View Client on a Pixel phone and I'm not having any problem.)
I'm automating the input process for a jetlag calculator android app Entrain. Using the culebra tool, I can find each of the views on the screen. But when I use the ViewClient.touch() method on a view, the program touches the view immediately above it on the screen.
For example, culebra lists these 2 views as the last views on the main menu of the app:
edu_umich_entrain___id_mainTableItem = vc.findViewWithTextOrRaise(u'Update Settings')
edu_umich_entrain___id_mainTableItem = vc.findViewWithTextOrRaise(u'Extras')
So I wrote this bit of code to touch the 'Extras' item:
vc = ViewClient(device, serialno)
vc.findViewWithTextOrRaise(u"Extras", root = 'ROOT').touch()
But it touches the 'Update Settings' view. (The same is true for any other view I touch.)
I've tried finding views with the findViewByIdOrRaise() method but I get the same result. I've tried the culebra GUI tool but it freezes when I click anywhere on the GUI.
I've written similar scripts to automate other android apps (Lutron, IAquaLink, Ankidroid) and they all work fine.
The coordinates for the 2 views are not overlapping, as revealed by getCoords:
print(vc.findViewWithTextOrRaise(u'Update Settings').getCoords())
print(vc.findViewWithTextOrRaise(u'Extras').getCoords())
((195, 1380), (945, 1566))
((195, 1575), (945, 1761))
If I calculate and touch the center of the 'Extras' view:
coords = vc.findViewWithTextOrRaise(u'Extras').getCoords()
x = (coords[1][0] + coords[0][0]) / 2
y = (coords[1][1] + coords[0][1]) / 2
vc.touch(x, y)
it still touches the higher 'Update Settings' view.
If I add 100 to the y axis of the center point, it finally touches the correct view. For now, I'll do that as a workaround.
coords = vc.findViewWithTextOrRaise(u'Extras').getCoords()
x = (coords[1][0] + coords[0][0]) / 2
y = (coords[1][1] + coords[0][1]) / 2 + 100
vc.touch(x, y)