jarmo/RAutomation

Button click does not work for me

Closed this issue · 5 comments

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.

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?

Here is the ControlPatterns:

image

image

image

It seems there is no useful ControlPatterns for these elements.

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

It works. Thank you very much. :)

👍