NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Jemmy JDialogOperator do not find JDialog

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
andvicoso



Joined: 20 Nov 2008
Posts: 42

PostPosted: Tue Jun 05, 2012 1:59 pm    Post subject: Jemmy JDialogOperator do not find JDialog Reply with quote

Hello all,

I've been struggling with this problem for a long time and I can't find an answer over the internet, so I'm trying it here.

I'm using Jemmy and JellyTools to create functional tests for my suite application. I have a modal JDialog that appears after a ActionNoBlock call from the main menu. But JDialogOperator don't find it. I'm sure the title is correct and I've tried to find it by index too, without success.

I've seen over the web that this problem can be associated with the running thread, but the ActionNoBlock call should resolve this issue, right?

The documentation is very poor. Can somebody help me?

Thanks in advance
[]'s
Back to top
andvicoso



Joined: 20 Nov 2008
Posts: 42

PostPosted: Tue Jun 05, 2012 3:09 pm    Post subject: Reply with quote

This is not what I wanted, but solved my problem.
I solved it using a brute force algorithm:

Code:


public static JDialogOperator getDialogOperator(final String pTitle) {
        try {
            Thread.currentThread().sleep(DEFAULT_WAIT_TIME);//500 or 1000
        } catch (InterruptedException ex) {
        }

        JDialog d = null;

        for (final Window w : Window.getWindows()) {
            if (w instanceof JDialog) {
                final JDialog dTemp = (JDialog) w;
                if (dTemp.getTitle().equals(pTitle)) {//or equalsIgnoreCase
                    d = dTemp;
                    break;
                }
            }
        }

        if (d != null) {
            return new JDialogOperator(d);
        }
        return null;
    }
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo