0

I am trying to use UISpec4J in order to automate a Java Swing application. After adapter setup:

setAdapter(new MainClassAdapter(Main.class, new String[0]));

I am trying to obtain the main window:

Window mainWindow = getMainWindow();

Instead of a login dialog, I am getting a splash screen with logo of application. All my attempts to call this dialog manually have failed.

How can I get the list of opened dialogs/windows?

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
Dmitry Bakaev
  • 129
  • 2
  • 14

1 Answers1

1

It looks like MainClassAdapter is not designed to handle a sequence of windows. However you can implement your own adapter that ignores the splash screen and returns the subsequent window. Here is a sample taken from UISpec4J forums:

setAdapter(new UISpecAdapter() {
    public Window getMainWindow() {
        final Window[] result = new Window[1];
        WindowInterceptor.init(new MainClassTrigger(Main.class, new String[0]))
            .processTransientWindow()
            .process(new WindowHandler() {
                public Trigger process(Window window) throws Exception {
                result[0] = window;
                return Trigger.DO_NOTHING;
                }
            })
        .run();
        return result[0];
    }
});
tenorsax
  • 21,123
  • 9
  • 60
  • 107