Working with Sliders tutorial find fails

Asked by John Townsend

I have just started with Sikuli Mac.

I'm working through the Sikuli "Working with Slider" tutorial (http://doc.sikuli.org/tutorials/sliders/sliders.html). The tutorial uses right().find to select the appropriate slider. However, I can't get Sikuli to find the Slider. I can find other elements in the window, but not the Slider control itself

Here's the script that I'm using. In this case, it can't find the slider control.

find(<alert volume image>).right().find(<slider control image>)

If I look just for the alert volume image (i.e. remove .right().find(<slider control image>), find does not fail:

find(<alert volume image>)

If I use right().find with a different image (for example the speaker icon), Sikuli can find the speaker:

find(<alert volume image>).right().find(<speaker icon>)

I have tried Matching Preview Similarity, but without any success. What is it about the Slider control that makes it tricky to find?

Any tips or suggestions are welcome.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Eugene S
Solved:
Last query:
Last reply:
Revision history for this message
Best Eugene S (shragovich) said :
#1

Hi,

As long as the image FULLY appears in the region you are looking in, there shouldn't be a problem.
First though is to verify that the pattern/image you are looking is COMPLETELY enclosed in the region you are looking in. In order to do that you might consider using the ".highlight(x)" option that will help you visualize the regions you are working with.

So in your case. try something like that:
reg = find(<alert volume image>).right().highlight(1) #Take a look at the region you are going to use to find your "speaker icon"

Then, when you are certain that the "speaker icon" is fully enclosed in region "reg", continue with:

reg.find(<speaker icon>).highlight(1) # you can highlight that part as well

Eugene

Revision history for this message
John Townsend (jtownsen) said :
#2

This suggestions where helpful. In particular, the advice to use highlight() to verify what Sikuli is finding is a good tip.

In my case, I found that if I selected an image that contained just the text "Output Volume", Sikuli would have a problem locating the slider control. If however, I select as the image the text "Output Volume" + the colon following the text and the speaker icon following the text and colon, Sikuli could highlight the slider control.

My advice to other Sikuli novices is
 * Use the highlight() command to see that Sikuli is finding
 * If Sikuli can't find the image, try to capture more image

Thanks to Eugene S. for the assistance!