telenium icon indicating copy to clipboard operation
telenium copied to clipboard

select() may generate an identifier that is unusable

Open ryan-summers opened this issue 2 years ago • 2 comments

When using the select() function, the provided path cannot necessarily be used for a subsequent select() (or getattr(), etc) and will not properly select any items.

This appears to arise because the XPATH index syntax is slightly different than the path_to syntax use different semantics.

Specifically, the current to_path syntax uses the index of the element in the child widgets list. https://github.com/tito/telenium/blob/52e30bad3025c31749e9bab50a4bc5b62467679e/telenium/mods/telenium_client.py#L107-L114

However, the XPATH syntax uses the index into the list of previously filtered items. This means that if any items are filtered out, the index used by XPATH and the index into the Kivy child list are no longer equivalent.

ryan-summers avatar Feb 17 '22 14:02 ryan-summers

This becomes problematic whenever the children of a widget have different types. The fix here is to filter the path_to children list to include only children that have the same class as the current widget.

ryan-summers avatar Feb 17 '22 14:02 ryan-summers

Hi, thanks for posting the idea for a fix! I've noticed that there was no implementation for it and since I needed this feature I went ahead and implemented the fix with addition of a small correction.

Related PR: https://github.com/tito/telenium/pull/27

Hubix9 avatar Jul 21 '23 19:07 Hubix9