|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.swtbot.swt.finder.SWTBot
org.eclipse.swtbot.forms.finder.SWTFormsBot
public class SWTFormsBot
SWTFormsBot is a SWTBot with capabilities for testing eclipse forms.
SWTBot} - SWTBot for usage examples.| Field Summary | |
|---|---|
static long |
DEFAULT_POLL_DELAY
Deprecated. |
protected Display |
display
The display on which the bot operates on. |
protected Finder |
finder
The finder used by the bot to find controls. |
| Constructor Summary | |
|---|---|
SWTFormsBot()
Constructs a bot. |
|
SWTFormsBot(ControlFinder controlFinder,
MenuFinder menuFinder)
Constructs an instance of the bot using the given control finder and menu finder. |
|
SWTFormsBot(Finder finder)
Constructs a bot with the given finder. |
|
SWTFormsBot(Widget parent)
Constructs a bot that will match the contents of the given parentWidget. |
|
| Method Summary | ||
|---|---|---|
SWTBotShell |
activeShell()
Gets the current active shell. |
|
boolean |
captureScreenshot(String fileName)
Captures a screenshot to the given file name. |
|
Display |
getDisplay()
Gets the display |
|
Finder |
getFinder()
|
|
Control |
getFocusedWidget()
Returns the control which currently has keyboard focus, or null if keyboard events are not currently
going to any of the controls built by the currently running application. |
|
SWTBotHyperlink |
hyperlink()
|
|
SWTBotHyperlink |
hyperlink(int index)
|
|
SWTBotHyperlink |
hyperlink(String mnemonicText)
|
|
SWTBotHyperlink |
hyperlink(String mnemonicText,
int index)
|
|
SWTBotHyperlink |
hyperlinkInGroup(String inGroup)
|
|
SWTBotHyperlink |
hyperlinkInGroup(String inGroup,
int index)
|
|
SWTBotHyperlink |
hyperlinkInGroup(String mnemonicText,
String inGroup)
|
|
SWTBotHyperlink |
hyperlinkInGroup(String mnemonicText,
String inGroup,
int index)
|
|
SWTBotHyperlink |
hyperlinkWithId(String value)
|
|
SWTBotHyperlink |
hyperlinkWithId(String value,
int index)
|
|
SWTBotHyperlink |
hyperlinkWithId(String key,
String value)
|
|
SWTBotHyperlink |
hyperlinkWithId(String key,
String value,
int index)
|
|
SWTBotImageHyperlink |
imageHyperlink()
|
|
SWTBotImageHyperlink |
imageHyperlink(int index)
|
|
SWTBotImageHyperlink |
imageHyperlink(String mnemonicText)
|
|
SWTBotImageHyperlink |
imageHyperlink(String mnemonicText,
int index)
|
|
SWTBotImageHyperlink |
imageHyperlinkInGroup(String inGroup)
|
|
SWTBotImageHyperlink |
imageHyperlinkInGroup(String inGroup,
int index)
|
|
SWTBotImageHyperlink |
imageHyperlinkInGroup(String mnemonicText,
String inGroup)
|
|
SWTBotImageHyperlink |
imageHyperlinkInGroup(String mnemonicText,
String inGroup,
int index)
|
|
SWTBotImageHyperlink |
imageHyperlinkWithId(String value)
|
|
SWTBotImageHyperlink |
imageHyperlinkWithId(String value,
int index)
|
|
SWTBotImageHyperlink |
imageHyperlinkWithId(String key,
String value)
|
|
SWTBotImageHyperlink |
imageHyperlinkWithId(String key,
String value,
int index)
|
|
SWTBotMenu |
menu(String text)
|
|
SWTBotMenu |
menu(String text,
int index)
|
|
SWTBotMenu |
menu(SWTBotShell shell,
Matcher<MenuItem> matcher,
int index)
|
|
SWTBotMenu |
menuWithId(String value)
|
|
SWTBotMenu |
menuWithId(String value,
int index)
|
|
SWTBotMenu |
menuWithId(String key,
String value)
|
|
SWTBotMenu |
menuWithId(String key,
String value,
int index)
|
|
|
performWithTimeout(Result<T> runnable,
long timeout)
Performs an operation with a timeout and return a result. |
|
void |
performWithTimeout(VoidResult runnable,
long timeout)
|
|
SWTBotShell |
shell(String text)
|
|
SWTBotShell |
shell(String text,
int index)
|
|
SWTBotShell |
shell(String text,
Shell parent)
|
|
SWTBotShell |
shell(String text,
Shell parent,
int index)
|
|
SWTBotShell[] |
shells()
Gets the list of shells found in the display. |
|
List<Shell> |
shells(String text)
|
|
List<Shell> |
shells(String text,
Shell parent)
|
|
SWTBotShell |
shellWithId(String value)
|
|
SWTBotShell |
shellWithId(String value,
int index)
|
|
SWTBotShell |
shellWithId(String key,
String value)
|
|
SWTBotShell |
shellWithId(String key,
String value,
int index)
|
|
void |
sleep(long millis)
Sleeps for the given number of milliseconds. |
|
protected Tray |
systemTray()
|
|
SWTBotTrayItem |
trayItem()
|
|
SWTBotTrayItem |
trayItem(int index)
|
|
List<SWTBotTrayItem> |
trayItems()
|
|
List<SWTBotTrayItem> |
trayItems(Matcher<?> matcher)
|
|
SWTBotTrayItem |
trayItemWithTooltip(String tooltip)
|
|
SWTBotTrayItem |
trayItemWithTooltip(String tooltip,
int index)
|
|
void |
waitUntil(ICondition condition)
Waits until a specified condition evaluates to true. |
|
void |
waitUntil(ICondition condition,
long timeout)
Waits until the timeout is reached or the condition is met. |
|
void |
waitUntil(ICondition condition,
long timeout,
long interval)
Waits until the condition has been meet, or the timeout is reached. |
|
void |
waitUntilWidgetAppears(ICondition waitForWidget)
|
|
void |
waitWhile(ICondition condition)
Waits while the condition is true. |
|
void |
waitWhile(ICondition condition,
long timeout)
Waits while the condition is true, until the timeout is reached. |
|
void |
waitWhile(ICondition condition,
long timeout,
long interval)
Waits while the condition is true, until the timeout is reached. |
|
|
widget(Matcher<T> matcher)
|
|
|
widget(Matcher<T> matcher,
int index)
|
|
|
widget(Matcher<T> matcher,
Widget parentWidget)
|
|
|
widget(Matcher<T> matcher,
Widget parentWidget,
int index)
|
|
|
widgets(Matcher<T> matcher)
|
|
|
widgets(Matcher<T> matcher,
Widget parentWidget)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Deprecated public static final long DEFAULT_POLL_DELAY
protected final Display display
protected final Finder finder
| Constructor Detail |
|---|
public SWTFormsBot()
public SWTFormsBot(Widget parent)
parent - the parent
public SWTFormsBot(ControlFinder controlFinder,
MenuFinder menuFinder)
controlFinder - the ControlFinder used to identify and find controls.menuFinder - the MenuFinder used to find menu items.public SWTFormsBot(Finder finder)
finder - the finder.| Method Detail |
|---|
public SWTBotHyperlink hyperlink(String mnemonicText)
mnemonicText - the mnemonicText on the widget.
SWTBotHyperlink with the specified mnemonicText.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotHyperlink hyperlink(String mnemonicText,
int index)
mnemonicText - the mnemonicText on the widget.index - the index of the widget.
SWTBotHyperlink with the specified mnemonicText.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotHyperlink hyperlinkWithId(String key,
String value)
key - the key set on the widget.value - the value for the key.
SWTBotHyperlink with the specified key/value.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotHyperlink hyperlinkWithId(String key,
String value,
int index)
key - the key set on the widget.value - the value for the key.index - the index of the widget.
SWTBotHyperlink with the specified key/value.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotHyperlink hyperlinkWithId(String value)
value - the value for the key SWTBotPreferences.DEFAULT_KEY.
SWTBotHyperlink with the specified value.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotHyperlink hyperlinkWithId(String value,
int index)
value - the value for the key SWTBotPreferences.DEFAULT_KEY.index - the index of the widget.
SWTBotHyperlink with the specified value.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotHyperlink hyperlinkInGroup(String inGroup)
inGroup - the inGroup on the widget.
SWTBotHyperlink with the specified inGroup.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotHyperlink hyperlinkInGroup(String inGroup,
int index)
inGroup - the inGroup on the widget.index - the index of the widget.
SWTBotHyperlink with the specified inGroup.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotHyperlink hyperlink()
SWTBotHyperlink with the specified none.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotHyperlink hyperlink(int index)
index - the index of the widget.
SWTBotHyperlink with the specified none.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotHyperlink hyperlinkInGroup(String mnemonicText,
String inGroup)
mnemonicText - the mnemonicText on the widget.inGroup - the inGroup on the widget.
SWTBotHyperlink with the specified mnemonicText with the specified inGroup.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotHyperlink hyperlinkInGroup(String mnemonicText,
String inGroup,
int index)
mnemonicText - the mnemonicText on the widget.inGroup - the inGroup on the widget.index - the index of the widget.
SWTBotHyperlink with the specified mnemonicText with the specified inGroup.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotImageHyperlink imageHyperlink(String mnemonicText)
mnemonicText - the mnemonicText on the widget.
SWTBotImageHyperlink with the specified mnemonicText.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotImageHyperlink imageHyperlink(String mnemonicText,
int index)
mnemonicText - the mnemonicText on the widget.index - the index of the widget.
SWTBotImageHyperlink with the specified mnemonicText.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotImageHyperlink imageHyperlinkWithId(String key,
String value)
key - the key set on the widget.value - the value for the key.
SWTBotImageHyperlink with the specified key/value.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotImageHyperlink imageHyperlinkWithId(String key,
String value,
int index)
key - the key set on the widget.value - the value for the key.index - the index of the widget.
SWTBotImageHyperlink with the specified key/value.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotImageHyperlink imageHyperlinkWithId(String value)
value - the value for the key SWTBotPreferences.DEFAULT_KEY.
SWTBotImageHyperlink with the specified value.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotImageHyperlink imageHyperlinkWithId(String value,
int index)
value - the value for the key SWTBotPreferences.DEFAULT_KEY.index - the index of the widget.
SWTBotImageHyperlink with the specified value.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotImageHyperlink imageHyperlinkInGroup(String inGroup)
inGroup - the inGroup on the widget.
SWTBotImageHyperlink with the specified inGroup.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotImageHyperlink imageHyperlinkInGroup(String inGroup,
int index)
inGroup - the inGroup on the widget.index - the index of the widget.
SWTBotImageHyperlink with the specified inGroup.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotImageHyperlink imageHyperlink()
SWTBotImageHyperlink with the specified none.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotImageHyperlink imageHyperlink(int index)
index - the index of the widget.
SWTBotImageHyperlink with the specified none.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotImageHyperlink imageHyperlinkInGroup(String mnemonicText,
String inGroup)
mnemonicText - the mnemonicText on the widget.inGroup - the inGroup on the widget.
SWTBotImageHyperlink with the specified mnemonicText with the specified inGroup.
WidgetNotFoundException - if the widget is not found or is disposed.
public SWTBotImageHyperlink imageHyperlinkInGroup(String mnemonicText,
String inGroup,
int index)
mnemonicText - the mnemonicText on the widget.inGroup - the inGroup on the widget.index - the index of the widget.
SWTBotImageHyperlink with the specified mnemonicText with the specified inGroup.
WidgetNotFoundException - if the widget is not found or is disposed.public SWTBotShell shell(String text)
text - the text on the shell.
public SWTBotShell shell(String text,
int index)
text - the text on the shell.index - the index of the shell, in case there are multiple shells with the same text.
Shell with the specified index.public List<Shell> shells(String text)
text - the text on the shell.
Shell with the specified index.
public SWTBotShell shell(String text,
Shell parent)
text - the text on the shell.parent - the parent under which a shell will be found.
public SWTBotShell shell(String text,
Shell parent,
int index)
text - the text on the shell.parent - the parent under which a shell will be found.index - the index of the shell, in case there are multiple shells with the same text.
Shell with the specified index.
public List<Shell> shells(String text,
Shell parent)
text - the text on the shell.parent - the parent under which a shell will be found.
Shell which matched.public SWTBotShell shellWithId(String value)
value - the value of the id
public SWTBotShell shellWithId(String key,
String value)
key - the key of the idvalue - the value of the id
public SWTBotShell shellWithId(String value,
int index)
value - the value of the idindex - the index of the shell, in case there are multiple shells with the same text.
public SWTBotShell shellWithId(String key,
String value,
int index)
key - the key of the idvalue - the value of the idindex - the index of the shell, in case there are multiple shells with the same text.
public SWTBotMenu menu(String text)
text - the text on the menu.
public SWTBotMenu menu(String text,
int index)
text - the text on the menu.index - the index of the menu, in case there are multiple menus with the same text.
public SWTBotMenu menuWithId(String value)
value - the value of the id.
public SWTBotMenu menuWithId(String value,
int index)
value - the value of the id.index - the index of the menu item, in case there are multiple shells with the same text.
public SWTBotMenu menuWithId(String key,
String value)
key - the key of the id.value - the value of the id.
public SWTBotMenu menuWithId(String key,
String value,
int index)
key - the key of the id.value - the value of the id.index - the index of the menu item, in case there are multiple shells with the same text.
public SWTBotMenu menu(SWTBotShell shell,
Matcher<MenuItem> matcher,
int index)
shell - the shell to search for the menu.matcher - the matcher used to find the menu.index - the index of the menu, in case there are multiple menus with the same text.
public <T extends Widget> List<? extends T> widgets(Matcher<T> matcher,
Widget parentWidget)
matcher - the matcher used to match widgets.parentWidget - the parent widget to search for a given widget.
public <T extends Widget> List<? extends T> widgets(Matcher<T> matcher)
matcher - the matcher used to match widgets.
public <T extends Widget> T widget(Matcher<T> matcher,
Widget parentWidget)
matcher - the matcher used to match widgets.parentWidget - the parent widget to search for a given widget.
public <T extends Widget> T widget(Matcher<T> matcher,
Widget parentWidget,
int index)
matcher - the matcher used to match widgets.parentWidget - the parent widget to search for a given widget.index - the index of the widget, incase the matcher finds multiple widgets
public <T extends Widget> T widget(Matcher<T> matcher,
int index)
matcher - the matcher used to match widgets.index - the index of the widget in case there are multiple widgets.
public <T extends Widget> T widget(Matcher<T> matcher)
matcher - the matcher used to match widgets.
public SWTBotShell[] shells()
public SWTBotShell activeShell()
throws WidgetNotFoundException
WidgetNotFoundException - if the widget is not found.public void waitUntilWidgetAppears(ICondition waitForWidget)
public void waitUntil(ICondition condition)
throws TimeoutException
condition - the ICondition to be evaluated.
TimeoutException - if the condition does not evaluate to true after SWTBotPreferences.TIMEOUT milliseconds.
public void waitUntil(ICondition condition,
long timeout)
throws TimeoutException
condition - the condition to be evaluated.timeout - the timeout.
TimeoutException - if the condition does not evaluate to true after timeout milliseconds.
public void waitUntil(ICondition condition,
long timeout,
long interval)
throws TimeoutException
condition - the condition to be evaluated.timeout - the timeout.interval - The delay time.
TimeoutException - if the condition does not evaluate to true after timeout milliseconds.
public void waitWhile(ICondition condition)
throws TimeoutException
condition - the ICondition to be evaluated.
TimeoutException - if the condition does not evaluate to false after SWTBotPreferences.TIMEOUT milliseconds.
public void waitWhile(ICondition condition,
long timeout)
throws TimeoutException
condition - the condition to be evaluated.timeout - the timeout.
TimeoutException - if the condition does not evaluate to false after timeout milliseconds.
public void waitWhile(ICondition condition,
long timeout,
long interval)
throws TimeoutException
condition - the condition to be evaluated.timeout - the timeout.interval - The delay time.
TimeoutException - if the condition does not evaluate to false after timeout milliseconds.public void sleep(long millis)
millis - the time in milliseconds for which to sleep.public Display getDisplay()
public boolean captureScreenshot(String fileName)
fileName - the filename to save screenshot to.
true if the screenshot was created and saved, false otherwise.SWTUtils.captureScreenshot(String)public Finder getFinder()
public Control getFocusedWidget()
null if keyboard events are not currently
going to any of the controls built by the currently running application.
nullDisplay.getFocusControl()public SWTBotTrayItem trayItem()
SWTBotTrayItempublic SWTBotTrayItem trayItem(int index)
index - he index of the tray item.
SWTBotTrayItem at specified indexpublic SWTBotTrayItem trayItemWithTooltip(String tooltip)
tooltip - the tooltip on the tray item.
SWTBotTrayItem with the specified tooltip.
public SWTBotTrayItem trayItemWithTooltip(String tooltip,
int index)
tooltip - the tooltip on the tray item.index - the index of the tray item.
SWTBotTrayItem with the specified tooltip.public List<SWTBotTrayItem> trayItems()
public List<SWTBotTrayItem> trayItems(Matcher<?> matcher)
matcher - the matcher used to match tray item
SWTBotTrayItem matching the matcher.protected Tray systemTray()
public <T> T performWithTimeout(Result<T> runnable,
long timeout)
This is a convenience api for performing a particular operation with a different timeout:
long timeout = ...;
long old = SWTBotPreferences.TIMEOUT;
SWTBotPreferences.TIMEOUT = timeout;
try {
// do something that takes very long
return aNumber;
} finally {
SWTBotPreferences.TIMEOUT = old;
}
The above can now be written as:
performWithTimeout(new Result() { public Integer run() { // do something that takes very long } }, timeout);
runnable - the runnable to execute.timeout - the timeout for performing the operation.
public void performWithTimeout(VoidResult runnable,
long timeout)
runnable - the runnable to execute.timeout - the timeout for performing the operation.for more information.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||