Im working with a Java web start app (run through a JNLP). Currently I'm trying to locate Main Frame for the application using this code:
Process p = Runtime.getRuntime().exec("C:\\Windows\\System32\\cmd.exe /c cd C:/Users/ash/Documents/MyApp/Environment & launcher.jnlp", null, new File("C:\\Users\\ash\\Documents\\MyApp\\Environment"));
p.waitFor();
Thread.sleep(40000);
robot = BasicRobot.robotWithCurrentAwtHierarchy();
robot.settings().delayBetweenEvents(50);
FrameFixture frame = WindowFinder.findFrame(getMainFrameByTitle(".*?MyApp.*?")).using(robot);
frame.focus();
However I'm getting an error:
org.fest.swing.exception.WaitTimedOutError: Timed out waiting for component to be found using matcher swing.app.simple.test.JavaSwingTests$9@6c5b675e Unable to find component using matcher swing.app.simple.test.JavaSwingTests$9@6c5b675e.
Below method is that I'm using for matching the frame by name:
private static GenericTypeMatcher<javax.swing.JFrame> getMainFrameByName(
final String frame) {
GenericTypeMatcher<javax.swing.JFrame> textMatcher = new GenericTypeMatcher<javax.swing.JFrame>(
javax.swing.JFrame.class) {
protected boolean isMatching(javax.swing.JFrame frameName) {
return (frame.replace(" ", "")).equals(frameName.getName()
.replace(" ", ""));
}
};
return textMatcher;
}
Can anyobody please advise if I'm doing anything wrong or not considering something I should. I'm new to FEST and just starting to use it
Thanks