* @param finder
* @param frameName
* @return the found frame, or null if no matching frame can be found.
*/
public static FrameFixture findFrameWithName(ComponentFinder finder, String frameName) {
FrameFixture result = null;
JFrame windowFrame = null;
FrameFixture frameFixture = null;
if (!threads.empty()) {
waitForIdle();
}
for (int i = 0; i < 1000 && result == null; i++) {
try {
if (windowFrame == null) {
windowFrame = (JFrame)finder.find(FrameMatcher.withName(frameName).andShowing());
}
if (frameFixture == null && windowFrame != null) {
if (robot == null) {
frameFixture = new FrameFixture(windowFrame);
robot = frameFixture.robot;
}
else {
frameFixture = new FrameFixture(robot, windowFrame);
}
}
if (frameFixture == null || !frameFixture.target.isVisible()) {
Task.delay(50);
continue;