Page 1 of 1

Java Swing jPopupMenu / contextmenu

Posted: Thu Apr 25, 2013 9:15 pm
by mattmccall
I am having trouble identify an object in a java swing application.

I am trying to track a menu item and its not finding it with the spy. All it is seeing is the selected frame and it cannot be found.

If I highlight the menu item a want to track and then do Ctrl+Win keys I can identify it. When I do this it gives me a path of:

/form[@title='<application name>']/contextmenu/menuitem[@text='<menu item text>']

It see's this item as a context menu of the application and not the selected frame. If I add this to the repository and try to click it for example the object is not found.

When I look at the details of this context menu it says its a jPopupMenu. I cannot find a way to access this menu and the items within the menu.

Does anyone have any suggestions?

Re: Java Swing jPopupMenu / contextmenu

Posted: Fri Apr 26, 2013 3:29 pm
by Support Team
Hello,

Thank you for your posting.

Unfortunately, I couldn't reproduce your issue.
In my test case, the recorded actions was executed successfully.

The path to your item looks correct.
Could you please send us a Ranorex Snapshot in order to analyze your issue?
Please take a look at Creating Ranorex Snapshot Files in our User Guide.

Thank you in advance.

Regards,
Markus (T)

Re: Java Swing jPopupMenu / contextmenu

Posted: Fri Apr 26, 2013 4:31 pm
by mattmccall
I attached a file using Ctlr+Win to spy the object:
ctrlWin_Snapshot.rxsnp
When I add /form[@title='C4C-THH']/contextmenu/menuitem[@text='Providers'] to my repository and try to ".click()" on the item I get an error saying there is no such thing.

Also, like i said before, if i try to track that item from the spy (not using Ctlr+Win) it only selects the selected frame.

I also attached a screen shot, this shows the menu I am trying to access, the menu is on the selected frame:
/form[@title='C4C-THH']/container[@name='desktop']/element[@accessiblename='UM Screen']

Screen shot:
Menu Item.png

Re: Java Swing jPopupMenu / contextmenu

Posted: Mon Apr 29, 2013 3:31 pm
by Support Team
Hello,

Thank you for the snapshot file, but unfortunately this file is invalid.
Could you please post another snapshot file?
Please take a look at the section "Creating Ranorex Snapshot Files" in order to get more information how to create snapshot files.
Thank you!

Regards,
Bernhard

Re: Java Swing jPopupMenu / contextmenu

Posted: Mon Apr 29, 2013 6:56 pm
by mattmccall
I opened the snapshot locally here, and I see what is shown in the attached screen shot. I am betting this is what you are seeing as well. This is what happens after a while to the object. The object becomes invalid. This is why I cannot find the object when I need it. I have no idea what is going on here.

I am working remotely today and for some reason the ctrl+Win is not working when I remote into my automation machine so tomorrow when I am in the office I will get another snapshot however I believe it will be the same thing as the one I attached earlier. I will also take a screen shot of it so that you can see what it looks like before it becomes invalid.

Re: Java Swing jPopupMenu / contextmenu

Posted: Mon Apr 29, 2013 7:49 pm
by mattmccall
Ok, I got another snapshot, but it is too big to attach. I attached a screen shot of what I see when I do this. Hopefully this one works.

Re: Java Swing jPopupMenu / contextmenu

Posted: Tue Apr 30, 2013 2:26 pm
by Support Team
Hello,

Thank you for the snapshot file, but unfortunately this file is also invalid.
I will send you an email with the access information to our ftp server. Please upload the snapshot file there.
You said that the object becomes invalid during the test.
Are there any error messages, or exceptions shown in the report file?
Could it be that the application crashed during the test run?
Are there any error messages in the Windows Event Viewer?
Thank you!

Regards,
Bernhard