How to hover on cascading menu that disappears with loss of application window focus

Asked by Sudipto Paul

Environment:
WinXP, 32-bit
Sikuli X-1.0rc2

Application under test:
Eclipse 3.5 based application

Hi,

I need to open a cascading menu item, in this sequence:
File->New->Item...

Issue I'm facing is that the cascading menu disappears with loss of focus, when I switch from the app to Sikuli.

I'd like to define a click for "File", then do a hover on "New", wait for "Item...", and then click on "Item...".
I am stuck at the point where I need to ( during Sikuli's image capture mode ) first click on "File" menu to make the "New" sub-menu appear.

Please advise.

Thanks,
Sudipto.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Anshu (anshu-ca) said :
#1

You can use keyboard shortcut keys to capture the menu , in this case.
Leave Sikuli open, leave the cursor where you want to insert the image, bring your App to focus , click on File->New->Item and now press Ctrl+Shift+2.
At this point you will notice the cursor changes to screen capture mode and you can drag the mouse - to capture the area - whatever you want.

Hope that helps
Anshu

Revision history for this message
Sudipto Paul (asudipto) said :
#2

Thanks Anshu, I'm able to record the menu items using this option.

However, the Eclipse based menu are very sensitive to mouse hover, and also there are multiple matches found if I do not record the full width of the menu.

What is happening is that once the File menu is clicked, the mouse can move in 3 ways (let's assume) to the "File->New" Menu:
a) Click File, move down to vertical center of next level menu's recorded image rectangle, move right to horizontal center of next level menu's recorded image rectangle, and click here
b) Click File, move right to horizontal center of next level menu's recorded image rectangle, move down to vertical center of next level menu's recorded image rectangle, and click here
c) Click File, traverse to resultant center of the next level menu's recorded image rectangle

I think the third option is happening currently.

The third option results in a mouse traversal path where in the horizontal neighbor of 1st level menu is hovered over for some milli-seconds and this invokes the drop down of that menu.

The way the menu looks is:

File | Edit | View
-------------------------------
New --------> Item
Open
Open With...

As a result, the Edit -> Cut menu is appearing, and the sub-menu to click is no longer visible.

I would like the first option to happen, to have a successful menu click.

I tried to reduce the width of the recorded "New" menu image, but then the image comparator engine seems to find multiple instances of the "New" string, elsewhere in the application (which is expected because of the application UI controls).

Thanks & Regards,
Sudipto.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

--1. if you want to use find() based on captured menu entry images:
you have to restrict the find operations to the area where it matches with the expected entry and nothing else
e.g. firstMenu.below().find(nextMenu)

--2. if you want to use hover()/click()
you should check wether mouseDown/mouesUp/mouseMove might give you more options to control the mouse movement/actions

-- 3. check whether it is better to use keyboard shortcuts/actions
so you might use type() and the arrow keys to navigate through a cascaded menu.

Revision history for this message
Rocky (asingh2783) said :
#4

Hi ,

the above suggestions did not work for me .
So i have this custom C# .Net application which has a dropdown menu and i have to just click the last menu item.

Steps
1) click (FileMenu)
2) wait(2)
3) click(find(Exit) )

after step 2 , the file menu disappears and the click fails .

any suggestions ?

Can you help with this problem?

Provide an answer of your own, or ask Sudipto Paul for more information if necessary.

To post a message you must log in.