Mac - Not able to recognize top/system bar

Asked by Kumar

I want to find top system/menu bar and click sign out.
But My code is not recognizing the top menu bar. It is there. I can see that clearly.
What am I doing wrong? I was looking up answers and FAQ. There is reference to screen(0).
Not sure how it helps me.
Thanks.

Here is the code (edited to remove local info)

# Sign out
myappMenu="MyappMenu.png"
myappOption="MyappMenuOptionMistral.png"
signOut="MyappMenuMistral.SignOut.png"

if exists(myappMenu):
    click(myappOption)
    click(signOut)
else:
    print("Myapp Menu not found"\n)
    sys.exit(1)

I am running IDE 1.1.0-Beta1
Build 2014-05-05-18

I am running IDE on
OS X 10.9.2

Model Name: MacBook Pro
  Model Identifier: MacBookPro10,1

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Kumar
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

I guess. that MyappMenu.png is the shot of your app's name on the Mac menubar (top of screen, always visible).

Since it is a bit tricky, to make shots from this bar: how did you manage to get the picture?

This is how it should work:
- start a screenshot
- move the mouse left below the wanted image on the bar (should be a point just below the lower edge)
- press and hold the mouse
- move to the top right of the wanted image
- release mouse

the problem:
the selection frame is not visible, because the bar is always on top

Revision history for this message
Kumar (lakshman) said :
#2

How I got MyappMenu.png?
I used Mac OS X feature that captures a screenshot of just the selected rectangle. Command+Shift+4

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

ok, then it should work.

Revision history for this message
Kumar (lakshman) said :
#4

Problem I have is exists(myappMenu) fails even though MyappMenu is on the desktop.

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

what is IDE Preview saying about the image?

Revision history for this message
Kumar (lakshman) said :
#6

The image preview looks fine.
I used capture() to create .png files and they are recognized. Whereas snapshots created using Mac OS are not recognized.

Is there any difference between snapshots created by capture() or Sikuli IDE AND snapshots created by Mac OS (Command+Shift+4)?

Revision history for this message
Kumar (lakshman) said :
#7

Forgot to mention that I tried to use the suggestion made above to capture top bar did not work. Then I tried using capture().

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

I can confirm, that I already found, that png files created by the Mac capture are not found by Sikuli.
But I did not investigate about the reason until now.

I make this a bug.

Revision history for this message
Kumar (lakshman) said :
#9

Thanks RaiMan for the confirmation. I will get new version with fix when it becomes available.