← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #204354]: Use testing methods in Eclipse

 

Question #204354 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/204354

    Status: Open => Answered

pyCoder proposed the following answer:
your answer to your question....

1) yes, you pass a path to those methods.


extra crap....


2) find vs exists..... what do you want to happen if the target image is not found? do you want it to throw or return None? Design, descision.
find() - http://sikuli.org/docx/region.html#Region.find
exists() - http://sikuli.org/docx/region.html#Region.exists

3) getLastMatch() -
http://sikuli.org/docx/region.html#Region.getLastMatch  This is a
preformance change to your code. Your telling your code hey that thing
you last looked for use it and preform a click on it. so this change is
not necssary.

4) write your paths like this with either '\\'   or  'r'
http://docs.python.org/reference/lexical_analysis.html#string-literals

r"C:\path\to\image.png"
or
"C:\\path\\to\\image.png"


optional.....


openApp("/Applications/jEdit.app")
wait("", 20000)
close = r"C:\path\to\image.png"   #I' a windows guy....
if find(close):
     click(getLastMatch())


optional.....


openApp("/Applications/jEdit.app")
wait("", 20000)
if find(r"C:\path\to\image.png"):
     click(getLastMatch())


optional.....


# http://sikuli.org/docx/globals.html#addImagePath
addImagePath(r"C:\path\to\image.png") # Add all your images at the top of your script.

openApp("/Applications/jEdit.app")
wait("", 20000)
if find("image.png"):     #then you can just call them byt file name
     click(getLastMatch())

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.