← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #241419]: SikuliX and Robot Framework integration

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
With version 1.0.1, the things have slightly changed 
(see https://github.com/RaiMan/SikuliX-API/wiki/Usage-in-Java-programming)

So normally there is no need to extract anything or set something on
Jython/Python path about Sikuli.

I recommend the following steps:
- empty the libs folder at C:\SikuliX\
- remove your extracted Lib folder
- run a jython.bat having C:\SikuliX\sikuli-jav.jar in classpath 
- you should get the interactive session

- alternativly for that put -Dsikuli.Debug=3 on the java execute statement in the bat
>import java.lang.System as JS
>JS.setProperty("sikuli.Debug", 3)

>import sys
>import org.sikuli.basics.SikuliXforJython
(this should dynamically add ...sikuli-java.jar/Lib to sys.path at runtime and copy the Lib folder to C:\SikuliX\libs\Lib (but currently only, when the libs folder is recreated ))

now you can activate Sikuli
>from sikuli import *

now you might test some Sikuli features, e.g.
>find(capture()).highlight(2)

you will capture some image, that should be found and highlighted.

If something goes wrong, the [debug] output might have a hint on the
problem.

If all is ok, just close the session with ctrl-d

Conclusion: when running from command line, take care that:
- C:\SikuliX\sikuli-jav.jar is in classpath
- have these 2 statements in the main script, before any Sikuli feature is used:
import org.sikuli.basics.SikuliXforJython
from sikuli import *

When working with Eclipse PyDev, in your project you only need a ref to
C:\SikuliX\sikuli-jav.jar in your project's class path and a ref to
C:\SikuliX\libs\Lib in the project's Pythonpath (which is only for the
editors auto features).

The above 2 imports will do their job at runtime as well.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.