Prerequisite
1. Download and install sikuli from for more information visit link "http://www.sikuli.org/download.html2. Download and install java 1.6
3. Download and setup eclipse with Test NG
I have created a sikuli script in which I open notepad, type some text and save file into system.
Step by Step working
1. Create a java project in to your eclipse.
2. Add "testng.jar" and "sikuli-script.jar" to your eclipse library.
3. Create a images folder into your java project as below.
4. Get images of using Sikuli IDE and put into images folder.
5. Create a java class into src folder.
6. Import sikuli classed and create Screen class object. as below java code:
package com.test;
import org.sikuli.script.App;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Screen;
import org.testng.annotations.Test;
public class SikuliTest {
public Screen screen;
@Test
public void tesSikuli() throws InterruptedException, FindFailed
{
//open note pad application
screen =new Screen();
App.open("notepad.exe");
Thread.sleep(2000);
//type text notepad
screen.type("images/InputFiled.png", "Testing sikuli with Test NG");
Thread.sleep(2000);
//click on file menu
screen.click("images/FileMenu.png", 20);
Thread.sleep(2000);
//click on save submenu
screen.click("images/SavesubMenu.png", 20);
Thread.sleep(2000);
//select file input field and type path
screen.click("images/FilePathInput.png", 20);
screen.type("images/FilePathInput.png", "C:\\test.txt");
Thread.sleep(2000);
//click save button
screen.click("images/SaveButton.png", 20);
Thread.sleep(2000);
}
}
7. Right click on eclipse test scripts and chose Run As > TestNG Test and click.
8. After successfully run you can see eclipse console log as below screen.
This is just awesome and very needed post for sikuli testng integration.
ReplyDeleteHello, could you provide some details about how to add Step 2 (Add "testng.jar" and "sikuli-script.jar" to your eclipse library)?
ReplyDeleteI use Mac, and I cannot find "sikuli-script.jar". It should be here: SikuliX-IDE/Content/Resources/. But it isn't. I found next information here
https://github.com/RaiMan/SikuliX-IDE/wiki/Release-Notes-IDE :
"You no longer need an extra sikuli-script.jar if you have the MacApp or sikuli-ide.jar".
Question: Should I add sikuli-ide.jar instead of sikuli-script.jar ?
Download "sikuli-script.jar" file from link: http://www.sikuli.org/download.html
DeleteTo add this jar file in eclipse follow below steps:
1. Right click on project>> Build Path>> Configure Build Path..
2. Click on libraries of opened window
3. Click "Add External Jar" button
4. Navigate "sikuli-script.jar" folder and select same jar file click "Open" button
Could u tel me how does sikuli can be integrated on ios side.
ReplyDeleteAwesome Post. However, need following info:
ReplyDeleteI am using Mac and have download latest SikuliX-1.1.0-Beta1 and couldn't find "sikuli-script.jar" file.
Please suggest?
I don't know how you are not getting I download Sikuli-X-1.0rc3 (r905)-win32.exe and after installation you will get "sikuli-script.jar" under installed directory
DeleteSame issue with me .. I am not able to get "sikuli-script.jar" anywhere.
ReplyDeleteGuys please share a link where we will get above mentioned jar.
After installation sikuli you will get jar file into installed folder.
DeleteHi,
ReplyDeleteI have created a project and i configured Jar file but i am getting below ERROR
"Screen cannot be resolved to a type"
Hi Brahma, you should add sikuli jar file in your eclipse environments
DeletePlease tell me how to add images as mentioned in Step4. I am using Eclipse+SikuliAPI+Java
ReplyDeletePlease tell me how to add images as mentioned in Step4. I am using Eclipse+SikuliAPI+Java
ReplyDeleteI mean from where to get those images mentioned in step 4 ?
ReplyDeleteYou can capture images of element using Skuli IDE or can capture image using manually
DeleteHi, what is the script for using sikuli on eclipse along with appium for mobile apps and games..kindly let me know... i am using genymotion emulator
ReplyDeletegood
ReplyDelete