{"id":25776923,"url":"https://github.com/rainmanwy/robotframework-SikuliLibrary","last_synced_at":"2025-02-27T06:07:01.357Z","repository":{"id":40762627,"uuid":"43926337","full_name":"rainmanwy/robotframework-SikuliLibrary","owner":"rainmanwy","description":"Sikuli Robot Framework Library provide keywords for Robot Framework to test UI through Sikuli.","archived":false,"fork":false,"pushed_at":"2022-06-20T10:18:58.000Z","size":17035,"stargazers_count":148,"open_issues_count":90,"forks_count":62,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-02-22T22:11:16.884Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rainmanwy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-09T01:42:18.000Z","updated_at":"2024-12-08T20:21:25.000Z","dependencies_parsed_at":"2022-07-29T12:49:14.700Z","dependency_job_id":null,"html_url":"https://github.com/rainmanwy/robotframework-SikuliLibrary","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainmanwy%2Frobotframework-SikuliLibrary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainmanwy%2Frobotframework-SikuliLibrary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainmanwy%2Frobotframework-SikuliLibrary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainmanwy%2Frobotframework-SikuliLibrary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rainmanwy","download_url":"https://codeload.github.com/rainmanwy/robotframework-SikuliLibrary/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240987435,"owners_count":19889335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-27T06:01:33.106Z","updated_at":"2025-02-27T06:07:01.347Z","avatar_url":"https://github.com/rainmanwy.png","language":"Java","funding_links":[],"categories":["测试"],"sub_categories":[],"readme":"Sikuli Robot Framework Library\r\n==============================\r\n\r\n## Introduction\r\nSikuli Robot Framework Library provides keywords to be used within [Robot Framework's](https://robotframework.org/) environment to test UI through [Sikulix](http://sikulix.com/), a automation tool that uses image recognition to identify and interact with UI components.  \r\n\r\nThis library supports python 2.x, and python 3.x\r\n\r\n## Mapping With Sikulix API Version\r\nAs this library is depended with sikulixapi, below table describe the mapping between SikuliLibrary version and sikulixapi version.\r\nBefore using this library, please check [doc of sikulix](https://sikulix-2014.readthedocs.io/en/latest/index.html), and make sure the environment satisfy the requirement of sikulix.\r\n\r\n|  SikuliLibrary          |  sikulixapi   |\r\n|  ---                    |  ---          |\r\n|  master                 |  2.0.5        |\r\n|  2.0.0                  |  2.0.4        |\r\n|  1.0.8                  |  2.0.1        |\r\n\r\n\r\n\r\n## Overview\r\n![](https://github.com/rainmanwy/robotframework-SikuliLibrary/blob/master/docs/img/architecture.png \"architecture\")\r\n* This library is implemented with [Robot Framework Remote Library](https://code.google.com/p/robotframework/wiki/RemoteLibrary)\r\n* Sikuli api is encapsulated as Robot keywords, and explored to clients with [jrobotremoteserver](https://github.com/ombre42/jrobotremoteserver)\r\n* Client is implemented with python and use Robot remote library to communicate with server side\r\n* Users could implement their own clients with different languages which support xml rpc\r\n\r\n\r\n## Keyword Documentation\r\n\r\nHere is a list of the available [Keywords](http://rainmanwy.github.io/robotframework-SikuliLibrary/doc/SikuliLibrary.html)\r\n\r\n# Getting Started \r\n\r\nThis guide will take you through setting up Robot Framework with Sikuli Library, on a Windows machine.\r\n\r\n\r\n## Step 1: Install the basic components\r\n\r\nMake sure you have at least java 8 installed, python 2.x or 3.x and [pip](https://pypi.org/project/pip/)  \r\n\r\nRun the command line below to check the currently version that you have installed:\r\n\r\nTo check java version:  ```java -version```\r\n\r\nTo check python version: ``` python --version ```\r\n\r\nTo check pip version:  ``` pip --version ```\r\n\r\n## Step 2: Install Robot Framework and Sikuli Library\r\n\r\nUsing pip, you can install Robot Framework\r\n\r\n```\r\npip install robotframework\r\n```\r\nAnd then install the library \r\n```\r\npip install robotframework-SikuliLibrary\r\n```\r\n\r\n* If target OS is Linux, please download linux version from [pypi](https://pypi.python.org/pypi/robotframework-SikuliLibrary)\r\n* Note: pypi version may not latest version, if you want to use latest version, please check \"Build With Maven\"\r\n\r\n\r\n## Other options for Linux users\r\n\r\n### Build With Maven\r\n* Clone this project, and execute maven package command\r\n* One zip file will be created in \"target\" folder, could unzip this file and add to PYTHONPATH\r\n* If want to installed to python, please execute\r\n```\r\npython setup.py install\r\n```\r\n\r\n### Note\r\n* For Linux, there are some dependencies need be installed, please check [sikuli quick start](http://www.sikulix.com/specials/files/linux-setup-prerequisites.html) to get more details.\r\n* Python should be installed as maven will execute python command\r\n* OS should allow java process access Internet \r\n\r\n# Writing your first test\r\n\r\n### Hello World Example\r\n```\r\n*** Settings ***\r\nDocumentation     Sikuli Library Demo\r\nTest Setup        Add Needed Image Path\r\nTest Teardown     Stop Remote Server\r\nLibrary           SikuliLibrary\r\n\r\n*** Variables ***\r\n${IMAGE_DIR}      ${CURDIR}\\\\img\r\n\r\n*** Test Cases ***\r\nWindows Notpad Hellow World\r\n    Open Windows Start Menu\r\n    Open Notepad\r\n    Input In Notepad\r\n    Quit Without Save\r\n\r\n*** Keywords ***\r\nAdd Needed Image Path\r\n    Add Image Path    ${IMAGE_DIR}\r\n\r\nOpen Windows Start Menu\r\n    Click    windows_start_menu.png\r\n\r\nOpen Notepad\r\n    Input Text    search_input.png    notepad\r\n    Click    notepad.png\r\n    Double Click    notepad_title.png\r\n\r\nInput In Notepad\r\n    Input Text    notepad_workspace.png    Hello World\r\n    Text Should Exist    Hello World\r\n\r\nQuit Without Save\r\n    Click    close.png\r\n    Click    dont_save.png\r\n```\r\n### Click In Example\r\n```\r\n*** Settings ***\r\nDocumentation     Sikuli Library Click In Example\r\nTest Setup        Add Needed Image Path\r\nTest Teardown     Stop Remote Server\r\nLibrary           SikuliLibrary\r\nLibrary           OperatingSystem\r\n\r\n*** Variables ***\r\n${IMAGE_DIR}      ${CURDIR}\\\\img\r\n\r\n*** Test Cases ***\r\nClick In Example\r\n    Open Example UI\r\n    Click Right OK Button\r\n    Click Left OK Button\r\n\r\n*** Keywords ***\r\nAdd Needed Image Path\r\n    Add Image Path    ${IMAGE_DIR}\r\n\r\nOpen Example UI\r\n    Run         chrome ${CURDIR}\\\\html\\\\click_in_demo.html\r\n\r\nClick Right OK Button\r\n    Click In        right_area.png      target.png\r\n\r\nClick Left OK Button\r\n    Click In        left_area.png      target.png\r\n\r\n```\r\n### Ruby Client Example\r\n```ruby\r\nrequire \"xmlrpc/client\"\r\nrequire \"pathname\"\r\n\r\nclient = XMLRPC::Client.new(\"127.0.0.1\", \"/\", 10000)\r\nclient.call(\"get_keyword_names\")\r\nclient.call(\"run_keyword\", \"addImagePath\", [Pathname.new(File.dirname(__FILE__)).realpath.to_s+\"/img\"])\r\nclient.call(\"run_keyword\", \"click\", [\"windows_start_menu.png\"])\r\nclient.call(\"run_keyword\", \"waitUntilScreenContain\", [\"search_input.png\", \"5\"])\r\nclient.call(\"run_keyword\", \"input_text\", [\"search_input.png\", \"notepad\"])\r\nclient.call(\"run_keyword\", \"click\", [\"notepad.png\"])\r\nclient.call(\"run_keyword\", \"doubleClick\", [\"notepad_title.png\"])\r\nclient.call(\"run_keyword\", \"click\", [\"close.png\"])\r\n```\r\n\r\n\r\n\r\n# Advance Options\r\n\r\n## Start Server Manually\r\nSikuliLibrary contains a standalone jar file which could be started in command line. Sometimes user want to do test on different OS. The steps are:\r\n* Find SikuliLibrary.jar in \"SikuliLibrary/lib\" folder and upload to target OS.\r\n* Start jar with command\r\n```\r\njava -jar SikuliLibrary.jar  \u003cport\u003e  \u003ccaptured_imagine_folder\u003e\r\n```\r\n* User could use different clients to connect to server and call keywords. For example [Remote Library](https://github.com/robotframework/RemoteInterface) in robot framework.\r\n```\r\nLibrary        Remote        http://\u003cip\u003e:\u003cport\u003e/\r\n```\r\n\r\n## \"NEW\" mode\r\n* By default, SikuliLibrary will start sikuli java process implicitly when library is initializing by Robot Framework. This behavior bring some problems.\r\n* Now with **\"NEW\"** mode, user could use keyword [Start Sikuli Process](http://rainmanwy.github.io/robotframework-SikuliLibrary/doc/SikuliLibrary.html#Start%20Sikuli%20Process) to start the process explicitly.\r\nYou may check the detail in [issue 16](https://github.com/rainmanwy/robotframework-SikuliLibrary/issues/16)\r\n* Example:\r\n```\r\n*** Settings ***\r\nLibrary            SikuliLibrary     mode=NEW\r\nSuite Setup        Start Sikuli Process\r\nSuite Teardown     Stop Remote Server\r\n\r\n*** Test Cases ***\r\nNew Mode\r\n    Add Image Path    E:/config\r\n    Click             click.png\r\n```\r\n\r\n\r\n### Start Server\r\n```\r\njava -jar SikuliLibrary.jar 10000 .\r\n\r\n0 [main] INFO org.robotframework.remoteserver.RemoteServer  - Mapped path / to library com.github.rainmanwy.robotframework.sikulilib.SikuliLibrary.\r\n1 [main] INFO org.robotframework.remoteserver.RemoteServer  - Robot Framework remote server starting\r\n1 [main] INFO org.eclipse.jetty.server.Server  - jetty-7.x.y-SNAPSHOT\r\n28 [main] INFO org.eclipse.jetty.server.handler.ContextHandler  - started o.e.j.s.ServletContextHandler{/,null}\r\n129 [main] INFO org.eclipse.jetty.server.AbstractConnector  - Started SelectChannelConnector@0.0.0.0:10000\r\n129 [main] INFO org.robotframework.remoteserver.RemoteServer  - Robot Framework remote server started on port 10000.\r\n```\r\n\r\n## Disable Java Process Log File\r\nCould configure environment variable *DISABLE_SIKULI_LOG* to disable create log files\r\n```\r\nLinux: export DISABLE_SIKULI_LOG=yes\r\n```\r\n\r\n## Microsoft Management Console (MMC)\r\nIn Windows environment, some applications are created using MMC. SikuliX is only able to interact with MMC if you launch as Administrator the Sikuli IDE or the test script using SikuliX library.\r\n\r\nIf you start seeing errors like the below, you are running your tests against an MMC application as a non-admin:\r\n```\r\n[log] CLICK on L(1061,118)@S(0)[0,0 1920x1080]\r\n[error] RobotDesktop: checkMousePosition: should be L(1061,118)@S(0)[0,0 1920x1080]\r\nbut after move is L(137,215)@S(0)[0,0 1920x1080]\r\nPossible cause in case you did not touch the mouse while script was running:\r\n Mouse actions are blocked generally or by the frontmost application.\r\nYou might try to run the SikuliX stuff as admin.\r\n```\r\nAnother symptom is that your mouse will not move, and if it moves (there are random instances when the mouse moves), it will not click, so your test will fail. \r\n\r\nSetting UAC to the lowest level (not to notify the user) will reduce the instances of MMC dialogs. This does not mean that UAC is turned off, just that it does not have any unnecessary popup when your tests are being run (or you will have to take care of them in your test scripts).\r\n\r\n\r\n## Differences With Other Similiar Sikuli Libraries\r\n* Robot Remote Library technology is used, different client part program languages are supported\r\n* Do not plan to expose sikuli api to Robot Framework directly. All sikuli api are encapsulated as Keywords.\r\n* Wait functionality is added for each operations\r\n  ```java\r\n          public void click(String image) throws Exception{\r\n              wait(image, Double.toString(this.timeout));\r\n              try {\r\n                  screen.click(image);\r\n              }\r\n              catch (FindFailed e) {\r\n                  capture();\r\n                  throw new ScreenOperationException(\"Click \"+image+\" failed\"+e.getMessage(), e);\r\n              }\r\n          }\r\n  ```\r\n* Keyword to handel similiar images issue, could check \"click_in\" test suite in demo folder to get details\r\n  ```java\r\n     public void clickIn(String areaImage, String targetImage) throws Exception {\r\n         wait(areaImage, Double.toString(this.timeout));\r\n         Match match = screen.find(areaImage);\r\n         System.out.println(areaImage + \" is found!\");\r\n         match.click(targetImage);\r\n         capture(match.find(targetImage));\r\n     }\r\n  ```\r\n* Operating images could be shown in robot logs, easy to troubleshooting\r\n![](https://github.com/rainmanwy/robotframework-SikuliLibrary/blob/master/docs/img/log.png \"log\")\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainmanwy%2Frobotframework-SikuliLibrary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frainmanwy%2Frobotframework-SikuliLibrary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainmanwy%2Frobotframework-SikuliLibrary/lists"}