-->

FEST摇摆上点击新帧,无法进行新的框型治具(FEST Swing new frame on cli

2019-09-17 06:30发布

我试图写一个巨星摇摆测试,但我有麻烦/找到一个框架夹具。 我有两个JFrames,一个打开其他的点击,我想要么:

1。)发现打开了新JFrame的框架夹具

2)建立一个新框架固定了创建新的JFrame对象的(我可以从原来的JFrame对象的对象。)

我已经尝试使用

    GenericTypeMatcher<secondGUI> matcher = new GenericTypeMatcher<secondGUI>(secondGUI.class) {
        protected boolean isMatching(secondGUI frame) {
            System.out.println("0".equals(frame.getTitle()) && frame.isShowing());
            return "0".equals(frame.getTitle()) && frame.isShowing();
        }
    };
    Robot robot = BasicRobot.robotWithCurrentAwtHierarchy();

寻找帧,但碰上EdtViolationException。

我也曾尝试

    secondGUI secGUI = GuiActionRunner.execute(new GuiQuery<secondGUI>() {
        @Override
        protected secondGUI executeInEDT() throws Throwable {
            return firstGUI.getController().getWindows().get("0");
        }
    });
    FrameFixture secondWindow = new FrameFixture(secGUI);

但最后一行给了一个EdtViolationException为好。 有什么建议么? 谢谢!

Answer 1:

尝试寻找使用框架的标题你的框架:

Robot robot = BasicRobot.robotWithCurrentAwtHierarchy();
FrameFixture frame = WindowFinder.findFrame("Title of my frame").using(robot);

此外, secondGUI应该SecondGUI因为它是一个类名。

顺便说一句,很高兴看到另一个巨星用户。



文章来源: FEST Swing new frame on click, can't make new frame fixture
标签: java swing fest