jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

Window#controls does not work without any arguments when using MsUia adapter #73

Closed jarmo closed 6 years ago

jarmo commented 11 years ago

When using :ms_uia adapter then i'm getting an ArgumentError for the following code:

win.controls

Here is the relevant backtrace:

C:/bin/Ruby200/lib/ruby/gems/2.0.0/gems/rautomation-0.9.4/lib/rautomation/adapter/ms_uia/window.rb:216:in `controls': wrong number of arguments (0 for 1) (ArgumentError)

It seems to me that the problem is the fact that the Window#controls method is created by ElementCollections at https://github.com/jarmo/RAutomation/blob/master/lib/rautomation/adapter/ms_uia/window.rb#L11 and then overwritten at https://github.com/jarmo/RAutomation/blob/master/lib/rautomation/adapter/ms_uia/window.rb#L216-L219

It seems to me that the latter should be removed and the line @container.wait_until_present should be moved directly into ElementCollections.

@leviwilson, thoughts?

leviwilson commented 11 years ago

Sorry...wrong issue # in the commit :(

leviwilson commented 11 years ago

@jarmo for Window#controls, what would this look like for MsUia? Any AutomationElement that is a child of the Window?

jarmo commented 11 years ago

Yeah, why not. Think of it being similar to Watir where there are methods span, div etc and then there's the method element, which does not care about the type of element tag.

leviwilson commented 11 years ago

I guess my only thought was that for a ComboBox type control, rather than showing up as 1 Control in Window#controls it would show up as 1 + the number of items in the combo control.

jarmo commented 6 years ago

Closing this due to inactivity.