Screenshot feature

Asked by Francisco

Hello,

I've been testing some platforms online with another app, and i've come to a problem.
I need to take screenshots and have a way to know the coordinates of a certain point in a image, exactly like we can do with the screenshot feature of Sikuli.
I would like to know if you can tell me where i can see the code you made for that part, so i can see if i can aply something similar to what i'm using.

Thank you.

Regards.

Question information

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

I have no idea, what you are talking about.

--- exactly like we can do with the screenshot feature of Sikuli.
could you be more specific may be with an example.

--- have a way to know the coordinates of a certain point in a image
If you mean the Region button in the IDE, then you have with the latest 1.1.0 an additional Location button, to add a point to your script.

Revision history for this message
Francisco (fgmaltez) said :
#2

For example, i have a webpage with two buttons that are exactly the same. To choose which one i want to press, i want to take the sreenshot of the entire page and then write the coordinates of the button i chose.
Right now i need a functionality that gives me those coordinates.

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

buttons = "buttons.png"

# buttons.png is a screenshot that contains both buttons, but as little background as possible.

btn1 = Pattern(buttons).targetOffset(x1, y1)
btn2 = Pattern(buttons).targetOffset(x2, y2)

the (x,y) are the offset from the center of the buttons image to the click points of the buttons and can be evaluated using the IDE's Preview feature.

click(btn1) # will search the buttons image and click button 1

Revision history for this message
Francisco (fgmaltez) said :
#4

Thank you.

Revision history for this message
Francisco (fgmaltez) said :
#5

Thanks RaiMan, that solved my question.