I am knew to atomac UI automation tool, I am trying to access a button in my mac app and every time app loads buttons UIElement tree is changing because of which I am not able to re use in my code, below is my code
allButtons= allUIElement[5].findAllR(AXRole='AXButton')
print allButtons
position = allButtons[1].AXPosition
print position
size = allButtons[1].AXSize
print size
clickpoint = ((position[0] + size[0] / 2), (position[1] + size[1] / 2))
print clickpoint
test20Window.clickMouseButtonLeft(clickpoint)
As you can see in my code I am trying to access button from UIElement[5] which will dynamically change to say 6,7 or 1 when the app loads next time because of which the button which i want it to click is not happening
I see that you asked the question a while ago, but I hope this helps:
This way you find your application window dynamically.