← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #685325]: Sikuli java script instability

 

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

    Status: Needs information => Answered

masuo proposed the following answer:
example to capture screenshot when the image do not appear

import datetime
import shutil
SCREENSHOT = getBundlePath()+"\screenshot" 

#---------------------------
def capture_screen():
    tmppath = SCREEN.capture(SCREEN.getBounds()).getFile()
    capturefile = datetime.datetime.today().strftime("%Y%m%d-%H%M%S") + ".png"
    savepath = os.path.join(SCREENSHOT, capturefile)
    shutil.move(tmppath, savepath)

#---------------------------
if not exists("image.png",5):
    capture_screen()

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.