AirtestProject / Poco

A cross-engine test automation framework based on UI inspection
http://airtest.netease.com/
Apache License 2.0
1.77k stars 318 forks source link

Wrong x, y position of element #24

Open TimurNurlygayanov opened 6 years ago

TimurNurlygayanov commented 6 years ago

I'm testing native Android application with text menu, and trying to iterate via every menu item.

The problem with poco in the following:

poco(text='menu item text').click()

this code sometimes doesn't click anything (but sometimes works fine).

The following code:

    pos = poco(text='menu item text').get_position()
    y = pos[1] * poco.device.display_info['height']
    touch([100, y])

sometimes clicking wrong elements, because get_position() method returns the same Y value for two different menu items.

What we can use to properly click the item if poco lib detects it on the view? How to properly detect the Y position of item? Why sometimes it works, but sometimes - no? (for the same app&menu)

TimurNurlygayanov commented 6 years ago

found the workaround - remember Y position of each element at first initialisation of menu page, after some clicks poco starts to return wrong Y coords of the elements.

adolli commented 6 years ago

I am not sure what your hierarchy looks like. Is that the bounding box displayed properly in your hierarchy viewer?

adolli commented 6 years ago

If your menu items list vertically, it cannot be the same Y position.

TimurNurlygayanov commented 6 years ago

Archive.zip Example of menu in uiautomatorviewer ^^^ After we clicking to any menu item and return back, poco can't properly detect position of these elements (some of them, and it is strange).

adolli commented 6 years ago

Are you using AirtestIDE or just writing codes in your own editor? It seems that everything is OK in dump_1276712053355129766.uix.