我在我的 sikuli 脚本中遇到以下错误
+++ running this Java
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)
+++ trying to run SikuliX
+++ using: -Xms64M -Xmx512M -Dfile.encoding=UTF-8 -Dsikuli.FromCommandLine -jar
C:\Users\Administrator\Desktop\UI_testing\Setup\sikulix.jar
[info] HotkeyManager: add Capture Hotkey: CTRL+SHIFT 2 (50, 3)
[info] HotkeyManager: add Abort Hotkey: ALT+SHIFT C (67, 9)
[error] IDE: Remembered window not valid. Going to primary screen
Exception: **org.python.core.PyException thrown from the UncaughtExceptionHandler
in thread "Thread-13"**
检查并发现代码卡在我使用图像作为字典元素的行
for i in menubar:
exists(menubar[i]).highlight(3)
menubar
是一个 python 字典,其中包含以名称作为键存储的图像。
PS:代码
from sikuli import *
menubar={"file":"menubar_file.png","edit":"menubar_edit.png","view":"menubar_view.png","administration":"menubar_administration.png","tools":"menubar_tools.png","help":"menubar_help.png"}
for i in menubar:
assert exists(menubar[i]).highlight(2)