smysnk / sikuli-framework

SikuliFramework provides an object-oriented abstraction on top of Sikuli to assist with interacting GUI elements, such as sets of buttons, checkboxes, radio buttons, windows and dialogue hierarchies for GUI automation and testing.
Other
76 stars 26 forks source link

Sikuli-framework does not work on Linux #2

Open mandeepsandhu opened 10 years ago

mandeepsandhu commented 10 years ago

The current version of Sikuli - sikuli-java.jar, seems to be for the mac platform which cause it to fail under other platforms.

There are some platform specific libs which are included in the jar file (eg: files under META-INF/libs/ which contain platform specific shared objects) because of which the same jar file cannot be used across different OS platforms.

It'll probably be best, if we can reference Sikuli from an existing installation on the system rather than ship a platform specific jar.

There's another problem of Env.getOS() returning the wrong string when run on Linux. It returns MAC even on Linux. This is a known bug in the SikuliX jar.

mandeepsandhu commented 10 years ago

If we replace sikuli-java.jar with sikuli-script.jar (and change it in run.py as well), then basic things start working.

To make the calculator example work, I changed the path of the binary in calculator.py to the absolute path of the calculator application in Ubuntu for the MAC entry (as thats the OS string reported under Linux too, though this is just a temporary hack).

However, now it fails while trying to do a region match:

*INFO:1394712351971* Changing screenshot logging level
*INFO:1394712351974* [SikuliFramework] Booting.. SikuliVersion=Sikuli 1.0.1
*TRACE:1394712351983* Image search path: [u'/home/mandeep/work/sikuli-framework', u'/home/mandeep/work/sikuli-framework/examples/calculator/baseline/os/mac/', u'/home/mandeep/work/sikuli-framework/examples/calculator/baseline/']
*TRACE:1394712352004* Changing screenshot logging level
*INFO:1394712352006* []() is attempting to run [Calculator] wd=/home/mandeep/work/sikuli-framework
*TRACE:1394712352008* [Calculator:Application]() created
*INFO:1394712352009* []() created [Calculator] from [/usr/bin/gnome-calculator] [MAC None i386]
*TRACE:1394712352032* [Calculator,buttonClear:Button]() created
*TRACE:1394712352035* [Calculator:Application]() trying to validate, parentRegion=[None]() timeout=60
*TRACE:1394712352038* [Calculator:Application->Finder]() ["Baselines"]() colType=SERIES nameType=FULL
*TRACE:1394712352040* [Calculator:Application->Finder]()  colType=SERIES
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
*DEBUG:1394712353737* [Calculator:Application->Finder->Transform]() PREVIOUS Applied RegionMorph dx1=1 dy1=1 dx2=2 dy2=2 transform, ["R[0,0 1920x1080]"](efd4d32c5d3e4b934cdd27fa2139b831.png:Actual) -> ["R[1,1 1919x1079]"](da801f8772a8006f62db7ec8ff64befb.png:Actual) 
*TRACE:1394712353741* [Calculator:Application->Finder]() Loading ["P(/home/mandeep/work/sikuli-framework/examples/calculator/baseline/os/mac/Calculator/Calculator[0].png) S: 0.8"](5ced76556545937aa9f7315fcfd87aa5.png)
*TRACE:1394712355039* [Calculator:Application->Finder]() validated ["P(/home/mandeep/work/sikuli-framework/examples/calculator/baseline/os/mac/Calculator/Calculator[0].png) S: 0.8"](5ced76556545937aa9f7315fcfd87aa5.png) ["M[67,26 310x239]"](7065d254e551eaf4efeab8f6185d7a1e.png:Actual) in region ["R[1,1 1919x1079]"](70f797fb4bd427ebd22810eb80997bec.png:Actual) nameType=FULL colType=SERIES ser=0 seq=0
*DEBUG:1394712355142* [Calculator:Application->Finder->Transform]() NEXT Applied RegionBelow value=100 transform, ["M[67,26 310x239]"](8b5c28a3c390b455c04cb7483aa3950b.png:Actual) -> ["R[67,265 310x100]"](5696c3a23a549a00342aeaddc48848bf.png:Actual) 
Traceback (most recent call last):
  File "examples/calculator/add.py", line 50, in 
    calculator[Calculator.BUTTON_CLEAR].click() \
  File "/home/mandeep/work/sikuli-framework/src/entity/entities/clickableEntity.py", line 90, in click
    self.validate()
  File "/home/mandeep/work/sikuli-framework/src/entity/entity.py", line 354, in validate
    self.parent.validate()
  File "/home/mandeep/work/sikuli-framework/src/entity/entity.py", line 370, in validate
    self.region = self.regionFinder.find(timeout=timeout)
  File "/home/mandeep/work/sikuli-framework/src/entity/entity.py", line 370, in validate
    self.region = self.regionFinder.find(timeout=timeout)
  File "/home/mandeep/work/sikuli-framework/src/region/finder.py", line 297, in find
    result = self.performFind()
  File "/home/mandeep/work/sikuli-framework/src/region/finder.py", line 297, in find
    result = self.performFind()
  File "/home/mandeep/work/sikuli-framework/src/region/finder.py", line 348, in performFind
    region = Region(regions)
TypeError: org.python.proxies.sikuli.Region$Region$0(): 1st arg can't be coerced to org.sikuli.script.Region, java.awt.Rectangle
----------------------------
Performing post processing..
----------------------------
Done.

This was working before I pulled your changes. Somehow it's not after I updated my repo with the latest from upstream. Any idea what could be going wrong?

smysnk commented 10 years ago

With latest version of Sikuli (1.0.1) it looks like they've changed a bunch of the classes around, previously I was patching their Region class to add some additional functionality. I am going to take this logic and put into a helper class instead and it should be more stable.

Good point for referencing jar from an installation, I'll look into this. Keep you posted.

Thanks again.