私はJava Web Startアプリ(JNLPを介して実行)を使用しています。現在、次のコードを使用してアプリケーションのメイン フレームを見つけようとしています。
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();
ただし、エラーが発生します:
org.fest.swing.exception.WaitTimedOutError: マッチャーの swing.app.simple.test.JavaSwingTests$9@6c5b675e を使用してコンポーネントが見つかるのを待っているときにタイムアウトしました.
以下の方法は、フレームを名前で一致させるために使用しているものです。
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;
}
私が何か間違ったことをしているのか、それとも私がすべきことを考えていないのか、誰かアドバイスしてもらえますか。FEST は初めてで、使い始めたばかりです
ありがとう