← Back to team overview

sikuli-driver team mailing list archive

[Question #290922]: How to create a new function in the SikuliRemoteLibrary.py under the framework of RF+selenium+sikuli

 

New question #290922 on Sikuli:
https://answers.launchpad.net/sikuli/+question/290922

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 !
                         


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.