Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » widget with parent
widget with parent [message #18555] Sun, 01 February 2009 20:43 Go to next message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
Can we consider having api in SWTBot to search/find widget with given
parent? There is a method in SWTBotFactory, but you have to copy the
matcher. The api would really help when having to work with editor/views
trying to find widgets inside it...for example a StyledText in an editor.
Right now you have to copy the matcher for StyledText and use it with base
control in editor.
Re: widget with parent [message #18576 is a reply to message #18555] Mon, 02 February 2009 11:53 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Hi Ketan,

I did not quite understand that, could you elaborate with an example of
the API you're looking for ?

-- Ketan

On 2/2/09 02:13, Ketan Patel wrote:
> Can we consider having api in SWTBot to search/find widget with given
> parent? There is a method in SWTBotFactory, but you have to copy the
> matcher. The api would really help when having to work with editor/views
> trying to find widgets inside it...for example a StyledText in an
> editor. Right now you have to copy the matcher for StyledText and use it
> with base control in editor.
>
Re: widget with parent [message #19274 is a reply to message #18576] Mon, 02 February 2009 23:57 Go to previous messageGo to next message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
For example,
To find a button, there are lots of APIs, bot.button("test"), in SWTBot,
which will search the active shell.

But with now if you want to search for a button in eclipse view or editor,
you can use bot.button("test"), but it would be more reliable to says
bot.button("test", viewOrEditorControl) so it will search for the button
under viewOrEditorControl.

I mean using bot.button("test") will work but don't know what is going to
happen if there is one or more other views open with "test" button. This
would apply to all the APIs for finding widgets.

Right now what you have to do is, copy or create the matcher for button or
widget you are looking for and use the
org.eclipse.swtbot.swt.finder.SWTBotFactory.widget(Matcher<? >, Widget)
method. But thought might be easy to add code to automatically generate
these extra APIs to help reduce having to copy/recreating matchers for
common widgets.

Ketan Padegaonkar wrote:

> Hi Ketan,

> I did not quite understand that, could you elaborate with an example of
> the API you're looking for ?

> -- Ketan
Re: widget with parent [message #19319 is a reply to message #19274] Tue, 03 February 2009 00:02 Go to previous messageGo to next message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
I know I could also use the index, i.e. bot.button("test", index), but
this is not a reliable because you don't know which controls are open with
"test" button. At least, with a known parent, you know the expected
number of "test" buttons you will/should find.
Re: widget with parent [message #19365 is a reply to message #19319] Tue, 03 February 2009 02:54 Go to previous messageGo to next message
hugulas chen is currently offline hugulas chenFriend
Messages: 10
Registered: July 2009
Junior Member
RFT just using this way. They called it object map.
The object map use the parent and child widget relationships and some
special attributes to find widget.

I think the way that swtbot used is quite nice. Developers add id in
widget.It is so clear that we can identify it without confusion.
Re: widget with parent [message #19411 is a reply to message #19274] Tue, 03 February 2009 04:05 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 3/2/09 05:27, Ketan Patel wrote:
> For example, To find a button, there are lots of APIs,
> bot.button("test"), in SWTBot, which will search the active shell.
> But with now if you want to search for a button in eclipse view or
> editor, you can use bot.button("test"), but it would be more reliable to
> says bot.button("test", viewOrEditorControl) so it will search for the

This could mean that the API exactly doubles, and this particular use
case includes a lot of people, using this api not so frequently.

Could this be the case of another class (call it SWTBotParent or
something) and provides a the same api as SWTBot with additional parameter ?

While this API would be useful, I'm just thinking about the sheer number
of proposals the user would see when he types in a bot.button (it is
currently pegged at 20 per widget)

-- Ketan
Re: widget with parent [message #19502 is a reply to message #19411] Tue, 03 February 2009 23:56 Go to previous message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
Ya I had the same concerns about having to much api. I guess it's good
the way it is and worry about it when more people need it.
Previous Topic:Using custom applications for SWTBot testing instead of Eclipse examples
Next Topic:SWTBot examples for getting people started
Goto Forum:
  


Current Time: Sat Nov 09 02:57:57 GMT 2024

Powered by FUDForum. Page generated in 0.04264 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top