smysnk / sikuli-framework

SikuliFramework provides an object-oriented abstraction on top of Sikuli to assist with interacting GUI elements, such as sets of buttons, checkboxes, radio buttons, windows and dialogue hierarchies for GUI automation and testing.
Other
76 stars 27 forks source link

Sikuli-framework does not work on windows #1

Closed mandeepsandhu closed 10 years ago

mandeepsandhu commented 10 years ago

For starters, the sikuli-script.jar that's in the repo, seems to be for a Mac/OSX install. This needs to be made dynamic for different platforms.

Even after overwriting it with the correct version of the jar file, it fails in loading some libs. Here's the o/p:

WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0
x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[error] ResourceLoaderBasic: loadLib: Fatal Error 110: loading: WinUtil.dll
[error] ResourceLoaderBasic: loadLib: Since native library was found, it might b
e a problem with needed dependent libraries
C:\Users\mandeep\SikuliX\libs\WinUtil.dll: Can't find dependent libraries
[error] ResourceLoaderBasic: loadLib: Check, wether a valid Sikuli libs folder i
s in system path at runtime!
[error] Terminating SikuliX after a fatal error(110)! Sorry, but it makes no sen
se to continue!
If you do not have any idea about the error cause or solution, run again
with a Debug level of 3. You might paste the output to the Q&A board.
----------------------------
Performing post processing..
----------------------------
Done.
smysnk commented 10 years ago

I have to admit I haven't touched sikuli in ages as witnessed by the commit history on this project. I will take a look at this issue at get back to you. Thanks.

ps: You're the first one to show interest in this project, woo!

mandeepsandhu commented 10 years ago

Thanks Joshua!

We got it to work by first replacing sikuli-script.jar with the Windows version and also fixing a couple of imports in the python files. We're using SikuliX (and not old Sikuli), and that's probably the main reason why it was not working.

When you plan to test/fix the issue, you can try using SikuliX instead.

smysnk commented 10 years ago

Started fixing some of the issues, made a small commit but it looks like there is a ways to go.

mandeepsandhu commented 10 years ago

Great! Let me know if I can help in any testing. I'm new to Windows env and testing so bear with me if I ask something silly! :)

mandeepsandhu commented 10 years ago

Joshua, just thought I'd mention to you the changes I did for making the Calaculator example work under Windows (7):

Let me know if you want me to upstream these changes.

roomba commented 10 years ago

mandeepsandhu, would you mind sharing what the reg-ex fix was in formatter.py, thanks in advance.

mandeepsandhu commented 10 years ago

roomba, the fix is already checked-in in the latest version. See src/log/formatter.py's commit log for the changes. It was something like:

-            match = re.search(r"(?PMatch.*?\])", str(self.entity), re.IGNORECASE)
+            match = re.search(r"(?PM\[.*?\])", str(self.entity), re.IGNORECASE)

You can just pull in the latest commit and it should have all the fixes.

roomba commented 10 years ago

mandeep, pardon my ignorance but which repo do I pull it from, don't see those commits on this one, thanks again.

mandeepsandhu commented 10 years ago

They are there in the master branch of this repo. See this commit https://github.com/smysnk/sikuli-framework/commit/8e463ee6da173b9c61b422b6fe0ca7de57c05bd2

smysnk commented 10 years ago

I have commit soon to address SikuliX + region problems, probably tonight.

smysnk commented 10 years ago

Possible that these issues should be fixed now, give it a try and let me know. I'll test myself on Windows when I get home.

sneakypete81 commented 10 years ago

I'm still seeing the same error with Win8 and JRE7. If I set sikuli.Debug=3, I see:

C:\Users\me\Documents\GitHub\updatescanner\test\functional\externals\sikuli-framework>python run.py examples\calculator\add.py
Launching Jython [examples\calculator\add.py]...
java -Dsikuli.Debug=3 -cp java/jython.jar;java/*;. -Dpython.path=.;java/sikuli-script.jar/Lib;src;examples -Xmx1024M org.python.util.jython -Dpythonpath=. -Dloglevel=TRACE examples\calculator\add.py
May 27, 2014 4:13:50 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[debug] Jython: sikuli: __init__: entering
[debug] Jython: sikuli: Sikuli: entering
[debug] Jython: sikuli: Sikuli: constants
[debug] Jython: sikuli: Sikuli: import Region
[debug] Jython: sikuli: Sikuli: import Screen
[debug] Jython: sikuli: Sikuli: Env.addHotkey
[debug] Jython: sikuli: Sikuli: import Match
[debug] Jython: sikuli: Sikuli: import Pattern
[debug] Jython: sikuli: Sikuli: import Location
[debug] Jython: sikuli: Sikuli: import ScreenUnion
[debug] Jython: sikuli: Sikuli: import Finder
[debug] ResourceLoaderBasic: SikuliX Package Build: 1.0.1 12SEP2013160242
[debug] ResourceLoaderBasic: check: we are running on arch: x86
[debug] ResourceLoaderBasic: check: using Java at: C:/Program Files (x86)/Java/jre7/
[debug] ResourceLoaderBasic: check: Exists libs folder at location of jar? YES: C:/Users/me/Documents/GitHub/updatescanner/test/functional/externals/sikuli-framework/java/
[debug] ResourceLoaderBasic: checkLibsDir: C:/Users/me/Documents/GitHub/updatescanner/test/functional/externals/sikuli-framework/java/libs
[debug] ResourceLoaderBasic: loadLib: WinUtil
[debug] ResourceLoaderBasic: loadLib: Found: WinUtil
[error] ResourceLoaderBasic: loadLib: Fatal Error 110: loading: WinUtil.dll
[error] ResourceLoaderBasic: loadLib: Since native library was found, it might be a problem with needed dependent libraries
C:\Users\me\Documents\GitHub\updatescanner\test\functional\externals\sikuli-framework\java\libs\WinUtil.dll: Can't find dependent libraries
[error] ResourceLoaderBasic: loadLib: Check, wether a valid Sikuli libs folder is in system path at runtime!
[error] Terminating SikuliX after a fatal error(110)! Sorry, but it makes no sense to continue!
If you do not have any idea about the error cause or solution, run again
with a Debug level of 3. You might paste the output to the Q&A board.
[debug] SikuliXFinal: cleanUp: 0
----------------------------
Performing post processing..
----------------------------
Done.

I've tried downloading and running sikuli-setup.jar in the java folder to overwrite sikuli-script.jar, but get the same error.

If I modify run.py to execute a "normal" .sikuli script, it works fine:

java -Dsikuli.Debug=3 -jar java\sikuli-script.jar -r c:\Users\me\Desktop\Desktop.sikuli
May 27, 2014 4:35:30 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[debug] SikuliScript: CmdOrg: null
[debug] Running on Java 7 (1.7.0_55-b13)
[debug] --- Sikuli parameters ---
[debug] 1: -r
[debug] 2: c:\Users\me\Desktop\Desktop.sikuli
[debug] SikuliScript: givenScriptName: c:\Users\me\Desktop\Desktop.sikuli
[debug] SikuliX Jython Support Build: 1.0.1 12SEP2013160248
[debug] Trying to run script: c:\Users\me\Desktop\Desktop.sikuli\Desktop.py
[debug] JythonScriptRunner: : executeScriptHeader: adding SikuliX Lib path to sys.path
C:\Users\me\Documents\GitHub\updatescanner\test\functional\externals\sikuli-framework\java\sikuli-script.jar\Lib
[debug] Jython: sikuli: __init__: entering
[debug] Jython: sikuli: Sikuli: entering
[debug] Jython: sikuli: Sikuli: constants
[debug] Jython: sikuli: Sikuli: import Region
[debug] Jython: sikuli: Sikuli: import Screen
[debug] Jython: sikuli: Sikuli: Env.addHotkey
[debug] Jython: sikuli: Sikuli: import Match
[debug] Jython: sikuli: Sikuli: import Pattern
[debug] Jython: sikuli: Sikuli: import Location
[debug] Jython: sikuli: Sikuli: import ScreenUnion
[debug] Jython: sikuli: Sikuli: import Finder
[debug] ResourceLoaderBasic: SikuliX Package Build: 1.0.1 12SEP2013160242
[debug] ResourceLoaderBasic: check: we are running on arch: x86
[debug] ResourceLoaderBasic: check: using Java at: C:/Program Files (x86)/Java/jre7/
[debug] ResourceLoaderBasic: check: Exists libs folder at location of jar? YES: C:/Users/me/Documents/GitHub/updatescanner/test/functional/externals/sikuli-framework/java/
[debug] ResourceLoaderBasic: checkLibsDir: C:/Users/me/Documents/GitHub/updatescanner/test/functional/externals/sikuli-framework/java/libs
[debug] ResourceLoaderBasic: loadLib: WinUtil
[debug] ResourceLoaderBasic: loadLib: Found: WinUtil
[debug] ResourceLoaderBasic: loadLib: Now loaded: WinUtil
[debug] ResourceLoaderBasic: checkLibsDir: Using libs at: C:\Users\me\Documents\GitHub\updatescanner\test\functional\externals\sikuli-framework\
java\libs
[debug] ResourceLoaderBasic: check: Using this as OCR directory (tessdata) too
[debug] ResourceLoaderBasic: loadLib: VisionProxy
[debug] ResourceLoaderBasic: loadLib: Found: VisionProxy
[debug] ResourceLoaderBasic: loadLib: Now loaded: VisionProxy
[debug] Jython: sikuli: Sikuli: import App

Any ideas?

RaiMan commented 10 years ago

running 32-Bit Java does not work yet. see bug.

sneakypete81 commented 10 years ago

That was it! Thanks very much for the quick reply, much appreciated.

I got the 32-bit requirement from https://github.com/smysnk/sikuli-framework/wiki/Setup-%26-running-examples - probably needs updating. It also asks for JRE6, which is probably a bit too old to be recommending.