jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

Button click does not work for me #95

Closed leevyzz closed 10 years ago

leevyzz commented 10 years ago

I have a dialog, below is the UI spy screenshot.

image

There are three "End Meeting" controls, their control type are: "ControlType.Window", "ControlType.Button", "ControlType.TitleBar". I want to click button "End meeting" using script "window.button(:value=> 'End Meeting').click", but it does not work. I tried to click the button using script "controls(:value => 'End Meeting').each {|control| if control.focused? then control.click end }", it worked. but if use "control(:class => 'Button', :value => 'End Meeting').click", I will get the timeout error "RAutomation::WaitHelper::TimeoutError: timed out after 60 seconds". Could you help me?

Thank you.

leviwilson commented 10 years ago

When you select the "button" "End Meeting" element in the tree view in UI Spy, there will be a panel of properties about it. In there, what does it say for the ControlPatterns?

leevyzz commented 10 years ago

Here is the ControlPatterns:

image

image

image

It seems there is no useful ControlPatterns for these elements.

leviwilson commented 10 years ago

The one you want is screenshot number 2. I think rather than using :value, you should use :id. I think it's finding the 3rd one, which doesn't have the Invoke pattern (which is what you want).

window.button(id: '1').click
leevyzz commented 10 years ago

It works. Thank you very much. :)

leviwilson commented 10 years ago

:+1: