简体   繁体   中英

sikuli, how to capture screen where the script did not run well

Sikuli,如何捕获脚本运行不正常的屏幕,如果我在Sikuli中执行脚本时遇到错误,我正在执行Eclipse脚本。

You can use something like this to capture a screenshot:

def takeScreenShot(application):
 img = capture(SCREEN) # img is an image file .png in temp folder now
 ts = time.time()
 st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H-%M-%S')
 if not os.path.exists('PATH'):
  os.makedirs('')
 shutil.move(img, 'PATH\\%(appName)s\\%(timeStamp)s.png' %{"appName": application, "timeStamp": st})

You can call this method as a part of a try catch block.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM