daveenguyen / atomacos

Automated Testing on macOS
https://daveenguyen.github.io/atomacos/
GNU General Public License v2.0
47 stars 13 forks source link

object has no attribute 'AXChildren' #8

Closed daveenguyen closed 3 years ago

daveenguyen commented 5 years ago

Not sure how to reproduce this but am seeing this sometimes.

  File "/venv/lib/python2.7/site-packages/atomacos/_mixin/_search.py", line 49, in findAllR
    return list(self._findAll(recursive=True, **kwargs))
  File "/venv/lib/python2.7/site-packages/atomacos/_mixin/_search.py", line 23, in _findAll
    self._generateChildren(recursive=recursive),
  File "/venv/lib/python2.7/site-packages/atomacos/_mixin/_search.py", line 16, in _generateChildren
    for c in self._generateChildren(child, recursive):
  File "/venv/lib/python2.7/site-packages/atomacos/_mixin/_search.py", line 16, in _generateChildren
    for c in self._generateChildren(child, recursive):
  File "/venv/lib/python2.7/site-packages/atomacos/_mixin/_search.py", line 13, in _generateChildren
    for child in target.AXChildren:
  File "/venv/lib/python2.7/site-packages/atomacos/AXClasses.py", line 230, in __getattr__
    return super(NativeUIElement, self).__getattr__(name)
  File "/venv/lib/python2.7/site-packages/atomacos/_a11y.py", line 70, in __getattr__
    return self._get_ax_attribute(item)
  File "/venv/lib/python2.7/site-packages/atomacos/_a11y.py", line 257, in _get_ax_attribute
    raise AttributeError("'%s' object has no attribute '%s'" % (type(self), item))
AttributeError: '<class 'atomacos.AXClasses.NativeUIElement'>' object has no attribute 'AXChildren'
daveenguyen commented 5 years ago

Source code appears to guard against it https://github.com/daveenguyen/atomacos/blob/master/atomacos/_mixin/_search.py#L10-L13

daveenguyen commented 3 years ago

Trying to access AXChildren of something sometimes returns errors even if AXChildren is listed as an available in ax_attributes.

Original atomac didn't have this issue because it was catching the error when it's thrown. https://github.com/pyatom/pyatom/blob/master/atomac/AXClasses.py#L657-L660