← Back to team overview

ubuntu-phone team mailing list archive

Re: Autopilot: Get dynamic elements contained within a ListView

 

Hi,

On Fri, Jan 24, 2014 at 6:40 AM, Iain Lane <laney@xxxxxxxxxx> wrote:

> Sorry for the annoying questions, but I have another one now --- I can
> expand the ItemSelector from AP (modulo bug #1271969 which I worked
> around by calculating the coordinates),
>

Leo is waiting for some more information from you on that bug. If you've
got time to help him out we can fix this bug for everyone :)


> but then I don't know how to get
> at the items in it. The introspection tree is
> <http://paste.ubuntu.com/6804028/> (warning: huge) — I want to click the
> "By size" label. Trying item_selector.select_single(text="By size")
> doesn't find it. Is it because it's down a few levels of the tree? The
> code is "ItemSelector { … model: ["By name", "By size"] }" which I don't
> know how to attach ObjectNames to.
>

You don't need to use ObjectName, you can use any combination of type name
and zero or more filters to get you what you want. 'select_single' and
'select_many' all search through all ancestors of the object you call them
on - that is, they search children, children-of-children, etc. If you want
to search through just the immediate children, there are different methods
for that.

It looks to me like the most likely culprit for your problem is that at the
time you're makingn the selection, the object you want does not exist yet.
Qml is notorious for creating and destroying UI widgets (for example, when
you expand a tree widget thingie). We added the 'wait_select_single' method
to try and help with this - you give it a selection criteria, just like the
other selection methods, but it will wait a certain timeout until if finds
something that matches your query. Perhaps you could try using that?

If you have any more problems, feel free to ask us in #ubuntu-autopilot on
freenode.

Cheers,

-- 
Thomi Richards
thomi.richards@xxxxxxxxxxxxx

References