How to validate captured screen using sikuli

Asked by manas

How to validate captured screen using sikuli and displaye the output as pass or fail based on comparison?

Question information

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

- what do you want to compare with what?

- already looked into the docs? Do you understand how Sikuli works?

- already tried some basic scripting examples in the Sikuli IDE?

Revision history for this message
manas (mandalmanas786) said :
#2

I want to compare the screen shot and based on screen shot matched or not i want to display the output as Pass or Fail

Revision history for this message
Tim Tindell (tim-tindell) said :
#3

I hope this helps. I have been doing things just like this where I work. Use an if exists(img) case to see if it exists and if it does you print "pass" else print "fail" Here is an example:

if exists(img):
    print "pass"
else:
   print"fail"
Or you could make it write it to a file:
file=open(r"C:/Users/USERNAME/Desktop/test.txt", 'w')
if exists(img)
   file.write("pass')
else:
   file.write("fail")
file.close()

Obviously enter your own username. there is a get() to find the username of the current user. Comment if you want it.

Revision history for this message
manas (mandalmanas786) said :
#4

Thanks for the valuable information