很多同学在集成sikuli和Robotframework的时候,都参考了http://blog.mykhailo.com/2011/02/how-to-sikuli-and-robot-framework.html这篇经典文章。
其中关于包装sikuli的基本函数如下:
9 10 # =============================================== # 11 # SikuliWrapperOverwritten sikuli methods # 12 # =============================================== # 13 14 # function for calling native sikuli methods 15 def sikuli_method(name, *args, **kwargs): 16 return sys.modules['sikuli.Sikuli'].__dict__[name](*args, **kwargs) 17 18 # overwritten Screen.exists method 19 def exists(target, timeout=None): 20 addFoundImage(getFilename(target)) 21 return sikuli_method('exists', target, timeout)
*Setting* | *Value* | *Value* | *Value* | |
Library | SikuliWrapper | WITH NAME | wrapper | |
Test Timeout | 10 minutes | |||
*Variable* | *Value* | *Value* | *Value* | |
*Test Case* | *Action* | *Argument* | *Argument* | |
Test Sikuli | Exists | c:\\a.jpg | 5 | |
*Keyword* | *Action* | *Argument* | *Argument* | *Argument* |
exists函数的时候没有转型成为int或者double。解决方法,改变exists函数如下:
18 # overwritten Screen.exists method 19 def exists(target, timeout=None): 20 addFoundImage(getFilename(target)) 21 return sikuli_method('exists', target, int(timeout))