cannot make selenium and sikuli executable file

Asked by mohit singh

hi,
I made a website and flash automation project using selenium and sikulix 1.1 all is working fine but I'm not able to make a combined executable file which initiate all the selenium methods and after that run sikuli. My sikuli code is within a selenium method. All i need any executable jar or file to make my project standalone so that I can run it in another system just by double clicking a single file as I want it to be executed by scheduler.
I tried making runnable jar but only selenium is working. I am using sikuli (jython) , can anyone tell me how to do it.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1

Without makeing runnable jar ,SikuliX can be used on command line to run a Sikuli script or open the IDE.
http://sikulix-2014.readthedocs.io/en/latest/faq/010-command-line.html

Revision history for this message
mohit singh (meetmohit2101) said :
#2

Thanks for your reply @masuo but for further process I require an exucatble file , if you can provide me solution it will be of great help.Thanx!!

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Currently (SikuliX version 1.1.x) it is not possible to make a self contained executable (.exe).

A jar should be possible (depends on your build environment), that contains the sikulix.jar and only needs a working java installation.

To give you more advices at least the folder structure and the setup of you project with some explanation is necessary.

Revision history for this message
mohit singh (meetmohit2101) said :
#4

Thank you RaiMan, I'm using Eclipse (Juno) with java1.8 my folder structure is like
Project-->
Src -->Auto(package) --> Autotest.java , Mainone.java
libs --> all jars
images --> 1.png ,2.png, 3.png
Drivers--> chromedriver
configure.properties

Revision history for this message
RaiMan (raimund-hocke) said :
#5

So it all looks like Java programming.

If this is true, then a sikulixapi.jar should be in the libs folder.

How do you use the images in the images folder? Relative filenames like "images/1.png"?
Or did you setup an imagepath with a class reference?

I suppose, that your build setup takes care, that all jars in the lib folder are packed into the final jar and are on classpath at runtime.
Are you sure, this is true?

Revision history for this message
mohit singh (meetmohit2101) said :
#6

Yes , I'm using sikulixapi.jar and I have added it into lib folder and have added Images folder into source folder using build path so as to make a runnable jar including 'images'.
here is the sample code I'm using for imagepath :

try{
 Screen screen=new Screen();
    Pattern image1=new Pattern("\\Images\\1.png");
    Pattern image2=new Pattern("\\Images\\2.PNG");
    Pattern image3=new Pattern("\\images\\3.PNG");

screen.wait(image1, 35);
screen.click(image1);
screen.wait(image2, 35);
screen.click(image2);
screen.wait(image3, 35);
screen.click(image3);
}

cathch{
...
}

Revision history for this message
RaiMan (raimund-hocke) said :
#7

ok, I already thought, that you might have this problem:
This only works in the project context, as long as you are working in the file system, where everything is folders.

But after having made this fat jar, the images are inside the jar at runtime, and cannot be accessed by simply using a folder path.
A jar is a zip file principally, and content you want to access as normal files during runtime, have either be exported from the jar (which SikuliX itself does with various things or must be "input" from the jar with special java features.

On possibility is to use the image path feature, to let SikuliX find the images at runtime inside the jar:
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#image-search-path-where-sikulix-looks-for-image-files

read carefully, to understand the mechanics.

as far as I understand your setup, then you could use
Auto.Autotest/Images as the class reference for the jar situation and Images as alternate path for the project situation.
hence:
ImagePath.add("Auto.Autotest/Images", "Images")

... and your image references could be reduced to
    Pattern image1=new Pattern("1.png");
    Pattern image2=new Pattern("2.PNG");
    Pattern image3=new Pattern("3.PNG");

since they should now be found on the Imagepath

Revision history for this message
mohit singh (meetmohit2101) said :
#8

Only thing that I can see is ImagePath.PathEntry(); I cannot see setbundle();,getbundle(); or ImagePath.add();

Revision history for this message
RaiMan (raimund-hocke) said :
#9

be sure to use version 1.1.1 or 1.1.2

javadocs:
https://raiman.github.io/SikuliX-2014/javadocs/index.html

see class ImagePath

Can you help with this problem?

Provide an answer of your own, or ask mohit singh for more information if necessary.

To post a message you must log in.