jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

MsUia: ControlType "Button" not recognized if it is not in the class name #79

Closed leviwilson closed 6 years ago

leviwilson commented 10 years ago

Description

With the :ms_uia adapter, if you have an AutomationElement with the control type of Button, but the class name does not have 'button' in it, you cannot interact with it.

Proposed Solution

Remove the DEFAULT_LOCATORS definition since it is already checking the control type property to determine that it is a button.

leviwilson commented 10 years ago

The problem goes a bit deeper than this. Removing the DEFAULT_LOCATORS will work for an individual Window#button call, but for Window#buttons this breaks down, since that will depend on Win32 to locate the Windows that have the class name with /button/i. There is an inconsistency. This will affect both Window#buttons and Window#text_fields.

@jarmo - would you like me to create a separate issue for the #buttons / #text_fields issues? I can fix this issue, but it breaks buttons_spec.rb (only for :ms_uia though)

jarmo commented 10 years ago

Hmm, i would be in favor of removing DEFAULT_LOCATORS altogether from ms_uia if there's a better way to determine if something is a button or not. In win_32 solution like this seemed to be the only viable way.

#buttons might retrieve all the buttons which are buttons - maybe some similar solution could be used as for SelectList#options - retrieve all elements and then filter by type at Ruby side. Or retrieve only elements with correct type in the first place.

leviwilson commented 10 years ago

The better way is to use the control type property, which it already does. The caveat with this is that there's nothing (currently) in there to do this. I have ideas for this though, and it would fulfill #73 and #74.

jarmo commented 8 years ago

@leviwilson any progress with this?

jarmo commented 6 years ago

Closing this due to inactivity.