How to create a new function in the SikuliRemoteLibrary.py under the framework of RF+selenium+sikuli

Asked by luan0804hua

Eenvironment: Robot Framework 2.8.4
                              Python 2.7.5 on win32
                              RIDE 1.2.3
                              java version "1.6.0_45"
                              sikuli r930

Description:I use robotremoteserver.py SikuliRemoteLibrary.py sikuli-script.jar connect RF+selenium sikuli together. But I found that SikuliRemoteLibrary.py comes with the function is not enough. so I need to define a new function. So here comes the question...

Question:

check_object_exists_right() is a new function I define ,but it doesn't work well.
class SikuliRemoteLibrary:

    def __init__(self):
        self.SS = Screen()
        self.PT = Pattern()

    def check_object_exists_right(self, imgFile, position, space, Find_imgFile, timeOut, similarity):
        try:
            find = self.SS.click(self.SS.find(imgFile).left(500).find(Find_imgFile))
            print find
        finally:
                state = 1
        return state

the testcase in RIDE is:
check object exists right ${图片路径}\\Camera_Setup.png left 500 ${图片路径}\\set-menu-icon-off.png 10 0.91

RIDE execute error log:
20160413 20:42:25.161 : FAIL : ImportError: No module named sikuli
20160413 20:42:25.162 : DEBUG :
Traceback (most recent call last):
  File "SikuliRemoteLibrary.py", line 13, in check_object_exists_right
    find = self.SS.click(self.SS.find(imgFile).left(500).find(Find_imgFile))
  File "<string>", line 1, in <module>

WHY:
          I find that,when it define like this it will works well.
          find = self.SS.click(self.SS.find(imgFile))

          but if it define like this it will be error .
          find = self.SS.click(self.SS.find(imgFile).left(500).find(Find_imgFile))

          And if I define like this only run by sikulir930 or run by Eclipse+Selenium2+sikuli-script.jar ,it works well too.
          find = self.SS.click(self.SS.find(imgFile).left(500).find(Find_imgFile))

so,how can I define a new function to use this codes: find = self.SS.click(self.SS.find(imgFile).left(500).find(Find_imgFile))

thanks a lot !

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

You have to check your RIDE setup.
The needed module sikuli.py contained in the sikuli-script.jar cannot be accesed.

Sikuli does not work with Python, but uses the bundled java based Jython interpreter.
Therefor it works in the other mentioned environments.

BTW: you should switch to version 1.1.0 (http://sikulix.com) if possible, since the Sikuli versions you are using are no longer supported.

Where did you get SikuliRemoteLibrary.py ??

Can you help with this problem?

Provide an answer of your own, or ask luan0804hua for more information if necessary.

To post a message you must log in.