public final class WindowFinder extends Object
Understands lookup of
s and Frame
s. Lookups are performed till
the window of interest is found, or until the given time to perform the lookup is over. The default lookup time is 5
seconds.
Dialog
is the "entry point" of a fluent interface to look up frames and
dialogs. This example illustrates finding a WindowFinder
by name, using the default lookup time (5
seconds):
Frame
FrameFixture frame = WindowFinder.findFrame("someFrame").using(robot);
Where robot
is an instance of
.
Robot
This example shows how to find a
by type using a lookup time of 10 seconds:
Dialog
DialogFixture dialog = WindowFinder.findDialog(MyDialog.class).withTimeout(10000).using(robot);We can also specify the time unit:
DialogFixture dialog = WindowFinder.findDialog(MyDialog.class).withTimeout(10, SECONDS
).using(robot);
This example shows how to use a
to find a GenericTypeMatcher
with
title "Hello":
Frame
GenericTypeMatcher<JFrame> matcher = new GenericTypeMatcher<JFrame>() { protected boolean isMatching(JFrame frame) { return "hello".equals(frame.getTitle()); } }; FrameFixture frame = WindowFinder.findFrame(matcher).using(robot);
Modifier and Type | Method and Description |
---|---|
static DialogFinder |
findDialog(Class<? extends Dialog> dialogType)
Creates a new
capable of looking up a by type. |
static DialogFinder |
findDialog(GenericTypeMatcher<? extends Dialog> matcher)
Creates a new
capable of looking up a using the
provided matcher. |
static DialogFinder |
findDialog(String dialogName)
Creates a new
capable of looking up a by name. |
static FrameFinder |
findFrame(Class<? extends Frame> frameType)
Creates a new
capable of looking up a by type. |
static FrameFinder |
findFrame(GenericTypeMatcher<? extends Frame> matcher)
Creates a new
capable of looking up a using the
provided matcher. |
static FrameFinder |
findFrame(String frameName)
Creates a new
capable of looking up a by name. |
public static FrameFinder findFrame(String frameName)
FrameFinder
capable of looking up a Frame
by name.frameName
- the name of the frame to find.public static FrameFinder findFrame(Class<? extends Frame> frameType)
FrameFinder
capable of looking up a Frame
by type.frameType
- the type of the frame to find.public static FrameFinder findFrame(GenericTypeMatcher<? extends Frame> matcher)
FrameFinder
capable of looking up a Frame
using the
provided matcher.matcher
- the matcher to use to find a frame.public static DialogFinder findDialog(String dialogName)
DialogFinder
capable of looking up a Dialog
by name.dialogName
- the name of the dialog to find.public static DialogFinder findDialog(Class<? extends Dialog> dialogType)
DialogFinder
capable of looking up a Dialog
by type.dialogType
- the type of the dialog to find.public static DialogFinder findDialog(GenericTypeMatcher<? extends Dialog> matcher)
DialogFinder
capable of looking up a Dialog
using the
provided matcher.matcher
- the matcher to use to find a dialog.Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.