Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Using SWTBot to wait for a dialog to display
Using SWTBot to wait for a dialog to display [message #6169] Fri, 05 December 2008 23:15 Go to next message
Joe Luebker is currently offline Joe LuebkerFriend
Messages: 36
Registered: July 2009
Member
Hello,

In my trials of using SWTBot I just ran into the first instance where I
need to wait for a particular dialog to appear before continuing with a
test. I searched for some examples of this but didn't find any.

What is the syntax that I should use to wait for a shell with the name
"Configuration" to appear?

Looking at an implementation of shellWithId() I assumed I should do
something similar to the following:

WaitForShell waitForShell =
waitForShell(WidgetMatcherFactory.withText("Configuration"));
bot.waitUntilWidgetAppears(waitForShell);

Without any examples readily available I wanted to verify that this is
the suggested method for waiting for a dialog with a particular title.

Some comments:

- I think what would be extremely valuable to those getting familiar
with SWTBot if some examples of how to find/wait for various SWT
elements were made available.

- providing a SWTBot.shellWithText(String title) method would be useful.

Thanks,
Joe
Re: Using SWTBot to wait for a dialog to display [message #6184 is a reply to message #6169] Sat, 06 December 2008 01:27 Go to previous messageGo to next message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
I am using version 2.0 and it has following method to wait for shell:

/**
* @return a wrapper around a @{link Shell} with the specified text.
* @param text the text on the shell.
*/
public SWTBotShell shell(String text) {
return shell(text, 0);
}

/**
* @return a wrapper around a {@link Shell} with the specified index.
* @param text the text on the shell.
* @param index the index of the shell, in case there are multiple shells
with the same text.
*/
public SWTBotShell shell(String text, int index) {
WaitForShell waitForShell = waitForShell(withText(text));
waitUntilWidgetAppears(waitForShell);
return waitForShell.get(index);
}
Re: Using SWTBot to wait for a dialog to display [message #7552 is a reply to message #6184] Mon, 08 December 2008 17:58 Go to previous messageGo to next message
Joe Luebker is currently offline Joe LuebkerFriend
Messages: 36
Registered: July 2009
Member
Ketan Patel wrote:
> I am using version 2.0 and it has following method to wait for shell:
>
> /**
> * @return a wrapper around a @{link Shell} with the specified text.
> * @param text the text on the shell.
> */
> public SWTBotShell shell(String text) {
> return shell(text, 0);
> }
>
> /**
> * @return a wrapper around a {@link Shell} with the specified index.
> * @param text the text on the shell.
> * @param index the index of the shell, in case there are multiple shells
> with the same text.
> */
> public SWTBotShell shell(String text, int index) {
> WaitForShell waitForShell = waitForShell(withText(text));
> waitUntilWidgetAppears(waitForShell);
> return waitForShell.get(index);
> }
>

Thanks, I will try to use the SWTBotFactory.shell() method.

BTW, there is a difference in the APIs that you referenced versus what I
am using. I guess a difference in version 2.0 vs. version 2.0.0.1164?

I am using the latter and have the following APIs

/**
* @return a wrapper around a @{link Shell} with the specified text.
* @param text the text on the shell.
*/
public SWTBotShell shell(String text) {
return shell(text, 0);
}

/**
* @return a wrapper around a {@link Shell} with the specified index.
* @param text the text on the shell.
* @param index the index of the shell, in case there are multiple
shells with the same text.
*/
public SWTBotShell shell(String text, int index) {
return new SWTBotShell(shells(text).get(index));
}

/**
* @return a wrapper around a {@link Shell} with the specified index.
* @param text the text on the shell.
*/
public List<Shell> shells(String text) {
WaitForShell waitForShell = waitForShell(withText(text));
waitUntilWidgetAppears(waitForShell);
ArrayList<Shell> allShells = waitForShell.getAllShells();
return allShells;
}

Thanks,
Joe
Re: Using SWTBot to wait for a dialog to display [message #7614 is a reply to message #7552] Mon, 08 December 2008 23:56 Go to previous message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
I was not using the latest 2.0.0.1164 so the api could have changed.

Thanks,
Previous Topic:Test of a cascase menu
Next Topic:notifyKeyboardEvent and Editor
Goto Forum:
  


Current Time: Mon Sep 27 23:57:17 GMT 2021

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

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

Back to the top