Saturday, May 21, 2016

Robot Framework with Sikuli 1.1.0

Integration of Robot Framework with Sikuli 1.1.0

Pre-requsities:
1. Jython, Robot Framework (Jybot) should be installed and environment variables should be configured properly.
// Installation of Jython and Jybot are not covered here.

Sikuli installation steps:
1. Download the sikuli1.1.0 jar file from the website https://launchpad.net/sikuli/+download
2. Open the command prompt and install the sikuli as below

3. Choose the option 2

 4. Installation will be progress from internet and will be completed automatically


5. Once installation is completed, "sikulixapi.jar" file will be available in the corresponding folder.
6. To use the methods of sikuli in our jython script,  we have to add it in the jythonpath


7. Now open the command prompt and check its working properly.


8. Develop a sample jython script


"""Created on May 21, 2016
@author: vallikkv @ Vallinayagam.K
'''""

import org.sikuli.basics.SikuliXforJython
from sikuli import *


class Sikuli11Lib(object):
    ROBOT_CONTINUE_ON_FAILURE = True
    #Configure the path of image files
    myImagePath = "E:\\Sikuli11\\Images"
    addImagePath(myImagePath)


    def SampleMethod(self):
        click("1.PNG")
        click("2.PNG")

if __name__ == '__main__':
    a = Sikuli11Lib()
    a.SampleMethod()

9. Sample execution of  the script without integration of RF




10. To integrate with RF (Eg: Same script can be used to integrate with RF). Make sure the script file path is accessible by the RF+ Jybot, if not add it in the environment variable path

11, RF script by using the above sikuli script

*** Settings ***
Documentation  Testing with Sikuli 1.1.0 version

Library  Sample.Sikuli11Lib

*** Test Cases ***
Checking the version
    SampleMethod


12. Execute it using jybot



Note: This is a sample script, you can develop wrapper for sikuli methods and make it as common library which can be reused in robot framework like other libraries eg: Selenium2library


Reference: https://answers.launchpad.net/sikuli/+question/136170

No comments:

Post a Comment