|
|
|
Re: Would like to have relative searching based on Composite parent [message #525826 is a reply to message #525796] |
Wed, 07 April 2010 21:12 |
Ketan Padegaonkar Messages: 873 Registered: July 2009 |
Senior Member |
|
|
There are quite a few things that swtbot provides:
<widget>WithLabel:
bot.textWithLabel('your label')
This one looks for the *first* textbox after a label, not necessarily
the one immediately next to it, possibly even from a different
composite. It basically does a depth first traversal of the UI, adds
each widget into a list as it traverses. It then matches a label and
finds any text box after after the label.
<widget>InGroup:
bot.textWithLabelInGroup(label, group)
This one does something similar, but does a depth first traversal of the
group and not the entire shell, so I'd recommend using inGroup for
improving readability and reduce the number of places where you use indexes.
If you could provide a screenshot of the app and the control you can
access, we could help better.
– Ketan
eclipse.org/swtbot | twitter.com/ketanpkr
On 4/7/10 12:56 PM, Jeff Johnston wrote:
> In creating my SWTBot tests, I find that a number of widgets do not have
> labels so I am forced to use an index. This makes my tests very fragile.
>
> In many cases, there is in fact a label close by. For example, a
> StringFieldEditor takes a label argument, but actually creates a Label
> beside a Text widget. If one could say: "find me the Text widget that is
> after label "X" or find me the Nth Text widget for the Composite which
> is the direct parent of label "Y", this would make the tests better able
> to withstand UI changes elsewhere on a Window which may be out of my
> control (e.g. the Properties dialog).
>
> Seem reasonable?
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05787 seconds