2016-08-18 3 views
0

atomac UI 자동화 도구를 알고 있는데, 내 Mac 응용 프로그램에서 버튼에 액세스하려고 할 때마다 응용 프로그램 버튼이 UIElement 트리가 변경되어로드 될 때마다 내 코드에서 다시 사용할 수 없기 때문에 변경되었습니다. 아래 코드는 내 코드입니다.atomac/python에서 동적으로 변경되는 UIElements를 처리하는 방법은 무엇입니까?

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) 

당신은 내가 [5] 동적 때문에 내가 원하는 버튼의 6,7 또는 1 때 응용 프로그램로드 다음에 말을 바꿀 것이다 UIElement에서 버튼에 액세스하려고 내 코드에서 볼 수 있듯이 클릭이 발생하지 않습니다.

답변

0

잠시 전에 질문을했는데 도움이 되었기를 바랍니다.

your_app = atomac.getAppRefByLocalizedName("Your App Name") 
app_window = your_app.windows()[0] 
buttons = app_window.findAllR(AXRole='AXButton') 
your_button = buttons[0] 
button_position = your_button.AXPosition 
button_size = your_button.AXSize 
clickpoint = ((button_position[0] + button_size[0]/2), (button_position[1] + button_size[1]/2)) 
your_button.clickMouseButtonLeft(clickpoint) 

이렇게하면 응용 프로그램 윈도우를 동적으로 찾을 수 있습니다.

관련 문제