Friday, January 20, 2012

Installing Sikuli Automation Tool on Ubuntu 11.10

Sikuli is a cross-platform automation tool. The software uses computer vision technology to automate UI testing.

In this blog post I describe how to install and setup Sikuli on Ubuntu 11.10 OS.

Download the latest version of Sikuli (http://sikuli.org/download.shtml) and uncompress the zip file. You can also install Sikuli using Ubuntu package manager.


$ sudo apt-get install sikuli-ide

You will need OpenCV 2.1 or later to use Sikuli. If you see the following error, the OpenCV libraries are probably missing on your computer.


java.lang.UnsatisfiedLinkError: /tmp/tmplib/libVisionProxy.so: libml.so.2.1: cannot open shared object file: No such file or directory

Install OpenCV 2.3 on Ubuntu 11.10

Thanks to Gijs Molenaar we now have OpenCV 2.3 packages for Ubuntu. You can find full installation documentation here.

Open terminal and type the following commands to install OpenCV 2.3 packages. Remember to uninstall older OpenCV versions before you do this.


  $ sudo add-apt-repository ppa:gijzelaar/cuda
  $ sudo add-apt-repository ppa:gijzelaar/opencv2.3
  $ sudo apt-get update
  $ sudo apt-get install libcv-dev

Other Required Tools

The Sikuli documentation fails to mention that you need wmctrl package to launch and control GUI applications on Linux.

 $ sudo apt-get install wmctrl 

You are done!

You can now launch Sikuli by typing /usr/bin/sikuli-ide in the terminal program.

14 comments:

  1. When I install sikuli-ide it automatically installs libcv2.1 and therefore I'm unable to install opencv2.3. Any thoughts ?

    ReplyDelete
  2. Ingo, you can over-ride that with apt pinning if need.

    Can you give me the error message or something.

    ReplyDelete
  3. I installed Sikuli before reading your post, these are my findings.

    1. I installed Sikuli latest version from Sikuli.org on my ubuntu 11.10 - this doesn't seem to work - I got a ClassNotFoundError relating to Java. My opencv version was 2.1 which came with ubuntu

    2. After reading your post, I tried to upgrade opencv to 2.3, however the repository addition itself is timing out. So I could never get the latest version of Sikuli to work.

    3. So I started again from scratch - uninstalling everything including opencv, now installed Sikuli from ubuntu repository instead of from sikuli website. Open CV is still 2.1 - now Sikuli starts up I am yet to play with it.

    4. I am running open JDK 1.6

    ReplyDelete
  4. Further to my earlier comment, Arky can you confirm whether you run the scripts on Sikuli. I installed the ubuntu version and got the UI up and running. I am able to get screen shots taken and script written. When I try to run, I get an error as per this bug report

    https://answers.launchpad.net/sikuli/+question/185973

    If you are able to run the scripts, could you please confirm whether you use open jdk or sun jdk?

    ReplyDelete
  5. Krishna, Let me try to answer some of your questions. About Java, I use sun-java6-sdk. You can install Sun Java6 SDK on Ubuntu 11.11 from Ferram Roberto's JDK PPA.

    https://launchpad.net/~ferramroberto/+archive/java

    Regarding OpenCV, Here is what I have.


    $ apt-cache policy libopencv-core2.3
    libopencv-core2.3:
    Installed: 2.3.1-4ppa1
    Candidate: 2.3.1-4ppa1
    Version table:
    *** 2.3.1-4ppa1 0
    500 http://ppa.launchpad.net/gijzelaar/opencv2.3/ubuntu/ oneiric/main i386 Packages
    100 /var/lib/dpkg/status

    ReplyDelete
  6. Our sikuli IDE run. I use sikuli script, sikuli-ide code and images in sikuli script. How to read images in Eclipse with Ubuntu. I have a folder named images.sikuli and all my images are stored inside. The path used in my code as

    s.doubleClick("images.sikuli/1390382312030.png")

    ReplyDelete
    Replies
    1. Perhaps you could use relative path in script such as "~/path-to-directory/images.sikuli/1390382312030.png"

      HTH

      Delete
  7. I have used the relative path this is my code:-
    public void testUntitled() throws Exception {
    driver.get("https://www.google.co.in/#q=google+map+shimla");
    Settings.OcrTextRead =true;
    CodeSource codeSorce = GoogleMapTest.class.getProtectionDomain().getCodeSource();
    File file = new File(codeSorce.getLocation().toURI().getPath());
    String imagePath = "/sikulitestcase.sikuli/1390885779357.png";
    String path = file.getParentFile().getParent();
    imagePath = path.concat(imagePath);
    s.click(imagePath);
    s.wait((double) 1.0);
    String imagePath1 = "/sikulitestcase.sikuli/1390888745315.png";
    imagePath1 = path.concat(imagePath1);
    System.out.println("++++11111++++"+imagePath1);
    String imagePath2 = "/sikulitestcase.sikuli/1390888751024.png";
    imagePath2 = path.concat(imagePath2);
    System.out.println("+++2222++++"+imagePath2);
    s.dragDrop(imagePath1,imagePath2);
    s.wait((double) 1.0);
    String imagePath3 = "/sikulitestcase.sikuli/1390888899919.png";
    imagePath3 = path.concat(imagePath3);
    System.out.println("++33333+++"+imagePath3);
    s.exists(imagePath3);
    }
    I am using sikuli-java.jar in eclipse using window ubuntu

    ReplyDelete
    Replies
    1. You might wanna ask that question on stack overflow.

      http://stackoverflow.com/questions/tagged/sikuli

      Delete
  8. sir please guide me. m already used the relative path for images.sikuli/1390382312030.png but after run sikuli script the screen short image are not find on browser web page. :(

    ReplyDelete
  9. Thank you Mr. Arky and Mr. Gils!
    Using the four OpenCV commands in the article plus "sudo apt-get install tesseract-ocr", I can now run sikuli in xubuntu 13.10 x32...and hopefully more versions of linux aswell.
    Cheers :)

    ReplyDelete
  10. Now, sikuli can run directly on Android.
    Search AnkuLua on google play.

    ReplyDelete

You can leave a comment here using your Google account, OpenID or as an anonymous user.

Popular Posts