0

I am facing the below error in my sikuli script

+++ 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"**

Checked and found the code is getting stuck at a line where I used image as a dictionary element

for i in menubar:
    exists(menubar[i]).highlight(3)  

menubar is a python dictionary which contains images which are stored with their name as key.

PS : code

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)
Eugene S
  • 6,709
  • 8
  • 57
  • 91
alpha0
  • 65
  • 10

1 Answers1

0

The assert statement is testing a boolean expression that evaluates to True or False. The Sikuli exists() function however returns a Match object if a pattern found or None in the pattern was not found. You need to rewrite your code accordingly.

Also, I wouldn't use the highlight() like this as it is not clear what it is highlighting.

Eugene S
  • 6,709
  • 8
  • 57
  • 91