How to Click on a particular icon and then click on a button that appears on the screen.

Asked by sayantan

Using sikuli i want to click on a particular icon and then click on a particular button that appears after clicking on the previous icon.
code:
Screen s=new Screen(0)
s.click("icon.png") ----> Particular Icon on the screen

Region r1=s.exist("scrn.png") -------> A new image loads up
r1.click("button.png") -----> click on the new button

*
i am not able to click on the button, sikuli takes the mouse pointer to a different location than the location of the actual button.

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

Debug your script and try to understand what actually happens. Use highlight method to see what Sikuli finds on the screen.

Try:
Screen sc = new Screen(0);
sc.find("icon.png").highlight(1);

Using highlight will do two things:
1. It will show a red frame around the pattern that it finds so you can clearly see what Sikuli treats as match.
2. It will print out the Match details like that:

[log] highlight M[68,610 11x14]@S(S(0)[0,0 1680x1050]) S:0.86 C:73,617 [444 msec] for 1.0 secs

Here, among the rest, you can see the Similarity score (S:0.86 -> 86% in this case). So maybe you have another pattern on your screen that is similar or almost similar to the pattern that you are trying to match and it ends up with a false positive. In such case you should increase the similarity score to a higher value.

Revision history for this message
sayantan (sayantan-bhowmik94) said :
#2

Thanks Eugene S, that solved my question.