benbjohnson / melomel

External ActionScript Interface.
https://github.com/benbjohnson/melomel/wiki
Other
42 stars 8 forks source link

Can't find combo box nested inside datagrid. #32

Closed laran closed 13 years ago

laran commented 13 years ago

Here's my code:

def select(value, properties={}) Melomel::Cucumber.run! do classes = class_names_for_type('combo box')+ class_names_for_type('list')

    box = Melomel.find!(classes, properties)
    box.setFocus()

    labels = Melomel.items_to_labels!(box, box.dataProvider)
    index = nil
    labels.length.times do |i|
        if labels[i] == value
            index = i
        end
    end
    raise "Cannot find '#{value}' on #{type}" if index.nil?
    box.selectedIndex = index
end

end

and I'm calling it like this:

select value, :name => 'Business Unit'

There is an instance of a class which is included in the class names, with a name = 'Business Unit'. But I always get a "No object found (Melomel::MelomelError)".

If it helps the ComboBox is in a DataGrid which is in a wizard dialog.

Am I missing anything? Is there any asynchronous calling going on or anything that might cause a problem here?

benbjohnson commented 13 years ago

Are you popping up the dialog with PopUpManager? Are you able to find the combo box in a data grid outside of a dialog? I think the issue is that PopUpManager children are added to SystemManager.popUpChildren and are outside of the normal display list. I'll need to add a fix to search popUpChildren.

laran commented 13 years ago

I think we've put to bed the question about finding components in popups. I think this is more the datagrid issue.

I'm using Flex 3.5 if that's relevant.

laran commented 13 years ago

I needed to add a sleep in the ruby code. After adding that, it's working fine.