Sikuli integration into robotframework

4,038 views
Skip to first unread message

Sajjad Malang

unread,
Dec 24, 2010, 10:36:38 AM12/24/10
to robotframe...@googlegroups.com
Dear All,

I am planning to use the automation features of sikuli X [http://sikuli.org] inside rf. Sikuli runs on jython and is available as a java classes. From what I read [http://sikuli.org/documentation.shtml#/trac/wiki/SystemDesign] It generates it commans as .py script and then executes it using jython.

Is it possible to run jython commands directly from rf. has anyone tried this?

Any related help would be very useful. Thanks in advance.

Wishing you all Happy holidays and a great new year:)

--
Regards,
\Sajjad.

http://www.babycareindia.com

Mykhailo Moroz

unread,
Dec 24, 2010, 11:21:43 AM12/24/10
to sajjad...@gmail.com, robotframe...@googlegroups.com
Hi Sajjad,

I'm successfully running sikuli scripts using Robot Framework.
To run sikuli keywords from RF you should at first be able to run your
sikuli tests from java. Steps to achieve this are provided here
(https://answers.launchpad.net/sikuli/+faq/1110)

After that steps to run simple robot test case are following:
[my_test_case.txt]
***Settings***
Library | recorder.Recorder

***Test Cases***
Simple Test
Find And Click

1) use jybot (instead of pybot)
2) add sikuli-script.jar to CLASSPATH variable
3) add your python/java libs and sikuli libs to pythonpath

$ export CLASSPATH=sikuli-script.jar
$ jybot --pythonpath myLib:Lib my_test_case.txt

Another way is to use robotframework.jar according to the
http://code.google.com/p/robotframework/wiki/JavaIntegration:

$ java -cp sikuli-script.jar:robotframework.jar
-Dpython.path=myLib:Lib org.robotframework.RobotFramework
my_test_case.txt


Regards,
Mykhailo.

> --
> You received this message because you are subscribed to the Google Groups
> "robotframework-users" group.
> To post to this group, send email to robotframe...@googlegroups.com.
> To unsubscribe from this group, send email to
> robotframework-u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/robotframework-users?hl=en.
>

Pekka Klärck

unread,
Dec 27, 2010, 8:12:55 AM12/27/10
to moro...@gmail.com, robotframe...@googlegroups.com
2010/12/24 Mykhailo Moroz <mo...@mykhailo.com>:

>
> I'm successfully running sikuli scripts using Robot Framework.

This is so cool! Would you be interested to write a how-to about this
somewhere? The steps to get Sikuli integrated looked pretty simple and
it would be great to have them visible also somewhere else than on
this mail list archive.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

Sajjad Malang

unread,
Dec 27, 2010, 11:31:54 AM12/27/10
to Mykhailo Moroz, robotframe...@googlegroups.com
Hello Mykhailo,
Thanks for your mail. I am trying to do this in windows environment with Sikuli X because I need the ocr capability. But all the examples and configurations are for Sikuli 0.10. So im srugging a bit. I almost got it to work but im stuck with OpenCV not being able to find the dependencies.

[ ERROR ] Invalid syntax in file 'c:\tester.html'
 in table 'Setting': Creating an instance of the test library 'org.sikuli.script.Screen' with no arguments failed: UnsatisfiedLinkError: C:\Documents and Settings\u999999\Local Settings\Temp\tmplib\Win32Util.dll: Can't find dependent libraries
java.lang.UnsatisfiedLinkError:
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647)
        at java.lang.Runtime.load0(Runtime.java:770)
        at java.lang.System.load(System.java:1005)
        at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
        at org.sikuli.script.Win32Util.<clinit>(Win32Util.java:14)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.sikuli.script.Env.getOSUtil(Env.java:82)
        at org.sikuli.script.ScreenHighlighter.init(ScreenHighlighter.java:174)
        at org.sikuli.script.ScreenHighlighter.<init>(ScreenHighlighter.java:287)
        at org.sikuli.script.Screen.initBounds(Screen.java:96)
        at org.sikuli.script.Screen.<init>(Screen.java:108)

Regards,
\Sajjad.

Sajjad Malang

unread,
Dec 30, 2010, 5:18:08 AM12/30/10
to pe...@iki.fi, moro...@gmail.com, robotframe...@googlegroups.com
Dear All,
Thanks for the help. I got Sikuli 0.10.2 working on windows xp directly from robotframework and also use sikuli ide to create keywords. Do send me a link to the how-to, I can add a section for windows xp and sikuli ide integration as well.

Thanks.

Regards,
\Sajjad.


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To post to this group, send email to robotframe...@googlegroups.com.
To unsubscribe from this group, send email to robotframework-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.

imikemo

unread,
Dec 30, 2010, 7:13:17 AM12/30/10
to robotframework-users
Currently I'working on this how-to and share link ASAP.

imikemo

unread,
Dec 30, 2010, 7:13:25 AM12/30/10
to robotframework-users
On Dec 27, 6:31 pm, Sajjad Malang <sajjadmal...@gmail.com> wrote:
> Hello Mykhailo,
> Thanks for your mail. I am trying to do this in windows environment with
> Sikuli X because I need the ocr capability. But all the examples and
> configurations are for Sikuli 0.10. So im srugging a bit. I almost got it to
> work but im stuck with OpenCV not being able to find the dependencies.
>
> [ ERROR ] Invalid syntax in file 'c:\tester.html'
>  in table 'Setting': Creating an instance of the test library
> 'org.sikuli.script.Screen' with no arguments failed: UnsatisfiedLinkError:
> C:\Documents and Settings\u999999\Local Settings\Temp\tmplib\Win32Util.dll:
> Can't find dependent libraries

Win32Util.dll depends on jawt.dll, so add path to it (In my case "C:
\Program Files\Java\jre6\bin") to the PATH variable. This should help,
as now I'm able to run Sikuli X on Windows XP using command line:

java -Dpython.path=Lib\ -jar sikuli-script.jar calctest.sikuli

Sajjad Malang

unread,
Jan 5, 2011, 5:45:08 PM1/5/11
to moro...@gmail.com, mo...@mykhailo.com, robotframework-users
I found out the problem was. jython was picking up the wrong version of the jre. It uses the java_home to find the run time and it was set incorrectly on my pc. I deleted all the files in C:\jython2.5.1\cachedir\packages and found this out.

Thanks.

Warm Regards,
\Sajjad.

On Wed, Jan 5, 2011 at 12:34 PM, Sajjad Malang <sajjad...@gmail.com> wrote:
Hello,
Can you please help me? My integration works on Sikuli 0.10.2 but not on Sikuli X.

I added the sikuli-script.jar to the class path and sikuli-script.jar/Lib to jython.path

Then I add utill.py to Setting table as a library.
=============utill.py=================
from sikuli.Sikuli import *

class utill:

 def __init__(self):
  setBundlePath(__file__[:__file__.rindex('\\')])

 def showDesktop(self):
  click("1293626479770.png")

 def clickIE(self):
  click(Pattern("1293624545365.png").similar(0.90))

 def enterUrl(self, url):
  type("1293632514870.png", url + Key.ENTER )
=============utill.py=================

This works fine with Sikuli 0.10.2 but with Sikuli X I get the following error when utill class is imported.

=============error on screen=================

Sikuli vision engine loaded.
Text Recgonizer inited.
Windows utilities loaded.
VDictProxy loaded.
[ ERROR ] Invalid syntax in file 'c:\projects\dev_documentation\09_automated_tests\automated-tests\scenario\tester.html'
 in table 'Setting': Importing test library 'utill' failed: NoSuchMethodError: sun.awt.SunToolkit.isTranslucencyCapable(
Ljava/awt/GraphicsConfiguration;)Z
PYTHONPATH: [u'c:\\projects\\dev_documentation\\09_automated_tests\\automated-tests\\environment\\sikuli\\utill.sikuli',
 'C:\\Python27\\Lib\\site-packages', 'C:\\Python27\\Lib\\site-packages\\robot\\libraries', 'C:\\Projects\\DEV_documentat
ion\\09_Automated_Tests\\automated-tests\\environment\\libs\\sikuli-script.jar\\Lib', 'C:\\jython2.5.1\\Lib', '__classpa
th__', '__pyclasspath__/', 'C:\\jython2.5.1\\Lib\\site-packages', '.']
CLASSPATH: C:\jython2.5.1\jython.jar;.;environment\libs\ant.jar;environment\libs\automated-test-util.jar;environment\lib
s\axis.jar;environment\libs\bcprov-jdk15.jar;environment\libs\commons-beanutils.jar;environment\libs\commons-cli.jar;env
ironment\libs\commons-codec.jar;environment\libs\commons-collections.jar;environment\libs\commons-discovery.jar;environm
ent\libs\commons-httpclient.jar;environment\libs\commons-lang.jar;environment\libs\commons-logging.jar;environment\libs\
itext.jar;environment\libs\log4j.jar;environment\libs\mail.jar;environment\libs\not-yet-commons-ssl.jar;environment\libs
\ojdbc14-10.2.0.1.0.jar;environment\libs\poi-3.2.0.jar;environment\libs\sikuli-script.jar;environment\libs\soapui-xmlbea
ns.jar;environment\libs\soapui.jar;environment\libs\wsdl4j-soapui-fixed.jar;environment\libs\xbean-soapui-fixed.jar;C:\P
rogram Files\Java\jre6\lib\rt.jar
java.lang.NoSuchMethodError:
        at com.sun.awt.AWTUtilities.isTranslucencyCapable(Unknown Source)
        at com.sun.awt.AWTUtilities.setWindowOpaque(Unknown Source)
        at org.sikuli.script.Win32Util.setWindowOpaque(Win32Util.java:79)


        at org.sikuli.script.ScreenHighlighter.init(ScreenHighlighter.java:174)
        at org.sikuli.script.ScreenHighlighter.<init>(ScreenHighlighter.java:287)
        at org.sikuli.script.Screen.initBounds(Screen.java:96)
        at org.sikuli.script.Screen.<init>(Screen.java:108)
        at sikuli.Screen$py.__init__$2(C:\Projects\DEV_documentation\09_Automated_Tests\automated-tests\environment\libs
\sikuli-script.jar\Lib\sikuli\Screen.py:19)
        at sikuli.Screen$py.call_function(C:\Projects\DEV_documentation\09_Automated_Tests\automated-tests\environment\l
ibs\sikuli-script.jar\Lib\sikuli\Screen.py)
        at sikuli.Sikuli$py.initSikuli$20(C:\Projects\DEV_documentation\09_Automated_Tests\automated-tests\environment\l
ibs\sikuli-script.jar\Lib\sikuli\Sikuli.py:179)
        at sikuli.Sikuli$py.call_function(C:\Projects\DEV_documentation\09_Automated_Tests\automated-tests\environment\l
ibs\sikuli-script.jar\Lib\sikuli\Sikuli.py)
        at sikuli.Sikuli$py.f$0(C:\Projects\DEV_documentation\09_Automated_Tests\automated-tests\environment\libs\sikuli
-script.jar\Lib\sikuli\Sikuli.py:183)
        at sikuli.Sikuli$py.call_function(C:\Projects\DEV_documentation\09_Automated_Tests\automated-tests\environment\l
ibs\sikuli-script.jar\Lib\sikuli\Sikuli.py)
        at utill$py.f$0(c:\projects\dev_documentation\09_automated_tests\automated-tests\environment\sikuli\utill.sikuli
\utill.py:3)
        at utill$py.call_function(c:\projects\dev_documentation\09_automated_tests\automated-tests\environment\sikuli\ut
ill.sikuli\utill.py)
        at robot.utils.importing$py._import$4(C:\Python27\Lib\site-packages\robot\utils\importing.py:109)
        at robot.utils.importing$py.call_function(C:\Python27\Lib\site-packages\robot\utils\importing.py)
        at robot.utils.importing$py.import_$2(C:\Python27\Lib\site-packages\robot\utils\importing.py:73)
        at robot.utils.importing$py.call_function(C:\Python27\Lib\site-packages\robot\utils\importing.py)

=============error on screen=================




--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To post to this group, send email to robotframe...@googlegroups.com.
To unsubscribe from this group, send email to robotframework-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.

--

Mykhailo Moroz

unread,
Feb 7, 2011, 8:50:26 AM2/7/11
to robotframework-users
Hi to all,

Please have a look on the how-to about Sikuli and Robot Framework
Integration.
How-To: http://blog.mykhailo.com/2011/02/how-to-sikuli-and-robot-framework.html
Source code: https://github.com/imikemo/Sikuli-and-Robot-Framework-Integration

Look forward to your feedback and comments.
Best regards,

Mykhailo Moroz

On Dec 27 2010, 3:12 pm, Pekka Klärck <p...@iki.fi> wrote:
> 2010/12/24 Mykhailo Moroz <mo...@mykhailo.com>:
>
>
>
> > I'm successfully runningsikuliscripts using Robot Framework.
>
> This is so cool! Would you be interested to write a how-to about this
> somewhere? The steps to getSikuliintegrated looked pretty simple and

Pekka Klärck

unread,
Feb 9, 2011, 5:52:02 PM2/9/11
to mo...@mykhailo.com, robotframework-users
2011/2/7 Mykhailo Moroz <mo...@mykhailo.com>:

> Hi to all,
>
> Please have a look on the how-to about Sikuli and Robot Framework
> Integration.
> How-To: http://blog.mykhailo.com/2011/02/how-to-sikuli-and-robot-framework.html
> Source code: https://github.com/imikemo/Sikuli-and-Robot-Framework-Integration

Thanks a lot for writing such detailed instructions! I haven't had
need to try out Sikuli myself but know where to look for information
if I ever need to. Am I right that it isn't possible to create a
generic "SikuliLibrary" but instead you custom Sikuli script are the
library? Should we nevertheless link these instructions somewhere from
the project pages, possibly even from the test library pages?

One small correction about the Robot Framework preconditions: It is
actually possible to install the framework using Jython without having
Python installed at all, but this requires using the source
distribution. I noticed this wasn't mentioned too clearly on the
Installation wiki page and added some more information to
http://code.google.com/p/robotframework/wiki/Installation#Installing_from_source

Mykhailo Moroz

unread,
Feb 10, 2011, 10:50:23 AM2/10/11
to robotframe...@googlegroups.com
On Feb 10, 2011, at 12:52 AM, Pekka Klärck wrote:
> Am I right that it isn't possible to create a
> generic "SikuliLibrary" but instead you custom Sikuli script are the
> library?

I didn't think about creating generic "SikuliLibrary", and I looked
especially at the possibilities of extending existent Sikuli projects
via introducing Robot Framework.
I'll have a deep look at existent generic libraries for Robot
Framework and share my thoughts or even try to create a prototype of
generic "SikuliLibrary".
This is a nice topic for my next blogpost :)

> Should we nevertheless link these instructions somewhere from
> the project pages, possibly even from the test library pages?

It would be nice. Actually this blogpost is already linked from the
Sikuli documentation page as "Great 3-rd Party Articles"

> One small correction about the Robot Framework preconditions: It is
> actually possible to install the framework using Jython without having
> Python installed at all, but this requires using the source
> distribution. I noticed this wasn't mentioned too clearly on the
> Installation wiki page and added some more information to
> http://code.google.com/p/robotframework/wiki/Installation#Installing_from_source

Thank you for info, I've added update to the blogpost.

Best regards,
       Mykhailo

Eileen Wei

unread,
Feb 10, 2011, 11:12:31 AM2/10/11
to robotframework-users
It would be really nice to have a "SikuliLibrary" similar to the
existing "AutoItLibrary" :)

Eileen
> >http://code.google.com/p/robotframework/wiki/Installation#Installing_...

Mykhailo Moroz

unread,
Feb 9, 2011, 7:29:41 PM2/9/11
to Pekka Klärck, mo...@mykhailo.com, robotframework-users
On Feb 10, 2011, at 12:52 AM, Pekka Klärck wrote:
> Am I right that it isn't possible to create a
> generic "SikuliLibrary" but instead you custom Sikuli script are the
> library?

I didn't think about creating generic "SikuliLibrary", and I looked especially at the possibilities of extending existent Sikuli projects via introducing Robot Framework.


I'll have a deep look at existent generic libraries for Robot Framework and share my thoughts or even try to create a prototype of generic "SikuliLibrary".
This is a nice topic for my next blogpost :)

> Should we nevertheless link these instructions somewhere from


> the project pages, possibly even from the test library pages?

It would be nice. Actually this blogpost is already linked from the Sikuli documentation page as "Great 3-rd Party Articles"

> One small correction about the Robot Framework preconditions: It is


> actually possible to install the framework using Jython without having
> Python installed at all, but this requires using the source
> distribution. I noticed this wasn't mentioned too clearly on the
> Installation wiki page and added some more information to
> http://code.google.com/p/robotframework/wiki/Installation#Installing_from_source

Thank you for info, I've added update to the blogpost.

Best regards,
Mykhailo

Pekka Klärck

unread,
Mar 7, 2011, 6:55:49 PM3/7/11
to Mykhailo Moroz, mo...@mykhailo.com, robotframework-users
2011/2/10 Mykhailo Moroz <moro...@gmail.com>:

> On Feb 10, 2011, at 12:52 AM, Pekka Klärck wrote:
>
>> Should we nevertheless link these instructions somewhere from
>> the project pages, possibly even from the test library pages?
>
> It would be nice. Actually this blogpost is already linked from the Sikuli documentation page as "Great 3-rd Party Articles"

I forgot to do this before leaving for paternity leave but now this
great blog post is linked from
http://code.google.com/p/robotframework/wiki/TestLibraries

Zhang JiaQiang

unread,
May 30, 2012, 3:23:47 AM5/30/12
to Mykhailo Moroz, robotframework-users
Hello Mykhailo,

I followed your blog to integrate sikuli with RF. But I found that
when I've changed the verify_operation.txt to verify_operation.rest
(reStructuredText), RF will complain about the python module docutils
do not exist and cannot do the parsing.

I am quite sure the docutils already installed and it work well
standalone. (C:\python27\Lib\site-packages\docutils)

If there is any workaround for this ?

Best regards,
Zhang Jiaqiang

On Dec 25 2010, 12:21 am, Mykhailo Moroz <mo...@mykhailo.com> wrote:
> Hi Sajjad,
>
> I'm successfully runningsikuliscripts using Robot Framework.
> To runsikulikeywords from RF you should at first be able to run yoursikulitests from java. Steps to achieve this are provided here
> (https://answers.launchpad.net/sikuli/+faq/1110)
>
> After that steps to run simple robot test case are following:
> [my_test_case.txt]
> ***Settings***
> Library | recorder.Recorder
>
> ***Test Cases***
> Simple Test
>         Find And Click
>
> 1) use jybot (instead of pybot)
> 2) addsikuli-script.jar to CLASSPATH variable
> 3) add your python/java libs andsikulilibs to pythonpath
>
> $ export CLASSPATH=sikuli-script.jar
> $ jybot --pythonpath myLib:Lib my_test_case.txt
>
> Another way is to use robotframework.jar according to thehttp://code.google.com/p/robotframework/wiki/JavaIntegration:
>
> $ java -cpsikuli-script.jar:robotframework.jar
> -Dpython.path=myLib:Lib org.robotframework.RobotFramework
> my_test_case.txt
>
> Regards,
> Mykhailo.
>
>
>
>
>
>
>
> On Fri, Dec 24, 2010 at 5:36 PM, Sajjad Malang <sajjadmal...@gmail.com> wrote:
> > Dear All,
>
> > I am planning to use the automation features ofsikuliX [http://sikuli.org]
> > inside rf.Sikuliruns on jython and is available as a java classes. From

Pekka Klärck

unread,
May 30, 2012, 7:33:44 AM5/30/12
to zhangj...@gmail.com, robotframework-users
2012/5/30 Zhang JiaQiang <zhangj...@gmail.com>:
>
> I followed your blog to integrate sikuli with RF. But I found that
> when I've changed the verify_operation.txt to verify_operation.rest
> (reStructuredText), RF will complain about the python module docutils
> do not exist and cannot do the parsing.
>
> I am quite sure the docutils already installed and it work well
> standalone. (C:\python27\Lib\site-packages\docutils)

First of all, I doubt this has anything to do with Sikuli. You can
test that by creating a simple example that doesn't use Sikuli and
executing it.

Since you are using Sikuli, I assume you are running test with Jython.
Have you tested does Jython support docutils? Notice that you have
docutils installed under Python so it is also possible that Jython
just doesn't find the installation.

ZHANG Jiaqiang A

unread,
Jun 1, 2012, 3:56:04 AM6/1/12
to pe...@iki.fi, zhangj...@gmail.com, robotframework-users
Hello,

Sorry, it's my fault: I am using standalone robot jar.

Now I've switched to jython and now I can launch the testcase with rest format.

Best regards,
Zhang Jiaqiang
Reply all
Reply to author
Forward
0 new messages