Sikuli Tutorial
- Installing Eclipse Maven Plugin
- Installing Apache Maven
- Install Sikuli Script Jar in Maven Repository
- Creating Sikuli Maven Project
- Example program: Open a file in Widows Explorer
- Executing Sikuli Maven Project from Command line
- Selenium vs Sikuli
- Integrating Sikuli With Selenium WebDriver
Installing Eclipse Maven Plugin
Step #1:
Open Eclipse, Go to Help -> Install a new Software. Click on “Add” button and add the following URL.
Click on “OK” button.
Step #2:
Check All the check boxes listed, click “Next” and install the maven plugin.
(Click on image to enlarge)
Installing Apache Maven
Step #1:
Download latest version of maven from
here.
Step #2:
Extract the downloaded zip file and put it under somewhere in your machine.
Copy the bin folder path of Maven, and append the path in the environment variable.
(It requires JAVA_HOME variable in the environment variable. Please set JAVA_HOME variable in your environment)
Step #3:
Check whether maven installed correctly, Open command prompt and type “mvn -version”. It should return something like this,
(Click on image to enlarge)
It indicates Maven successfully installed in your machine.
Install Sikuli Script Jar in Maven Repository
As I mentioned in part -1, we’ve already got sikuli-script.jar, next we need to install sikuli-script.jar in maven repository.
By using the following command we can install sikuli-script.jar in maven repository.
Mvn install: install-file
-Dfile=D:\Jars\Sikuli-r930\win32\Sikuli-IDE\sikuli-script.jar
-DgroupId=com.test.sikuli -DartifactId=sikuli -Dversion-1.0.1
-Dpackaging=jar
(Click on image to enlarge)
Creating Sikuli Maven Project
Step #1:
Open Eclipse and create new Maven Project.
Step #2:
Add the following dependencies in your POM file.
2 | < groupId >com.test.sikuli</ groupId > |
3 | < artifactId >sikuli</ artifactId > |
4 | < version >1.0.1</ version > |
7 | < groupId >junit</ groupId > |
8 | < artifactId >junit</ artifactId > |
(Click on image to enlarge)
Step #3:
Create a package inside src/test/java and Create a class inside the
package. Now you can start writing the Sikuli script inside this class.
Sikuli Example Program: Open a file in Widows Explorer
Step #1:
Create a Sikuli Maven Project, as explained above.
Step #2:
Take screenshot of required elements and put it inside the Maven project.
– file.png
Step #3:
Create a class with name “Test1”, and Paste the following code inside the sikuli class.
4 | import org.sikuli.script.FindFailed; |
5 | import org.sikuli.script.Screen; |
10 | public void openFileTest() throws FindFailed, InterruptedException { |
14 | s.doubleClick( "file.png" ); |
15 | System.out.println( "File icon clicked" ); |
Executing Sikuli Maven Project from Command line
Step #1:
Open Command Prompt and cd to the project directory.
Step #2:
Execute the above project from command prompt using the following command.
mvn clean test -Dtest=Test1
Selenium Vs Sikuli
Integrating Sikuli With Selenium WebDriver
Step #1:
Create a new Java Project in eclipse by clicking New -> Java project.
Step #2:
- Right click on the Project Go to Build Path -> Configure Build Path.
- Switch to Libraries Tab.
- Click on “Add External Jars” and Add Selenium library jars as well as Sikuli-scritp.jar
Step #3:
Create a package inside src/ folder and create a class under that package.
Step #4:
Take All required screenshot of web elements and save inside the project.
Step #5:
Copy the following code inside that class.
3 | import org.openqa.selenium.WebDriver; |
4 | import org.openqa.selenium.firefox.FirefoxDriver; |
5 | import org.openqa.selenium.support.ui.WebDriverWait; |
6 | import org.sikuli.script.FindFailed; |
7 | import org.sikuli.script.Screen; |
9 | public class OnlinePainting { |
11 | public static void main(String[] args) throws FindFailed { |
14 | WebDriver driver= new FirefoxDriver(); |
15 | WebDriverWait wait= new WebDriverWait(driver, 20 ); |
16 | driver.manage().window().maximize(); |
17 | driver.get( "http://www.thecolor.com/Coloring/a-puppy-with-a-kitten.aspx" ); |
18 | Screen screen= new Screen(); |
19 | screen.wait( "1398665726055.png" , 20 ); |
20 | screen.click( "1398666382715.png" ); |
21 | screen.click( "1398666248846.png" ); |
22 | screen.click( "1398666729252.png" ); |
23 | screen.click( "1398666188894.png" ); |
24 | screen.click( "1398665763634.png" ); |
25 | screen.click( "1398666592027.png" ); |
26 | screen.click( "1398666610951.png" ); |
27 | screen.click( "1398666308624.png" ); |
28 | screen.click( "1398666326406.png" ); |
29 | screen.click( "1398666570749.png" ); |
30 | screen.click( "1398666703708.png" ); |
31 | screen.click( "1398666382715.png" ); |
32 | screen.click( "1398666857321.png" ); |
33 | screen.waitVanish( "1398665763634.png" ); |
Step #6:
Right click on the project, Select RunAs -> Java Application.
Before Execution:
After Execution:
Conclusion
- Sikuli scripts can be easily integrated with selenium WebDriver to automate flash websites.
- Sikuli can automate windows as well as all other applications.
- As it uses Visual match, we can automate almost anything, we see on the screen.
- It provides extensive support to Flash objects. i.e. we can automate adobe flash player components. (Audio player, video player)
- Sikuli scripts can be created as maven project and can be run from command prompt.
- Hence, Sikuli is most friendly, automation tool to automate challenging flash/windows applications.
bitlis
ReplyDeleteurfa
mardin
tokat
çorum
AVJZVQ
sakarya
ReplyDeleteelazığ
sinop
siirt
van
AWCMO1
whatsapp görüntülü show
ReplyDeleteücretli.show
08A4PR
62D79
ReplyDeleteEtimesgut Parke Ustası
Gümüşhane Lojistik
Ordu Şehirler Arası Nakliyat
Sakarya Şehir İçi Nakliyat
Sincan Fayans Ustası
Mardin Parça Eşya Taşıma
Aydın Parça Eşya Taşıma
Kırklareli Şehirler Arası Nakliyat
Aydın Şehir İçi Nakliyat
3B371
ReplyDeleteuşak telefonda görüntülü sohbet
çorum sesli sohbet sitesi
manisa bedava sohbet
ücretsiz sohbet sitesi
görüntülü sohbet siteleri
Aydın Parasız Sohbet
isparta telefonda kadınlarla sohbet
Niğde Görüntülü Sohbet Yabancı
mersin canlı sohbet uygulamaları
4E2B1
ReplyDeletebayburt sohbet siteleri
adıyaman telefonda görüntülü sohbet
elazığ canlı sohbet odaları
Kars Random Görüntülü Sohbet
Aydın Sesli Sohbet Odası
Hatay Kızlarla Rastgele Sohbet
konya telefonda görüntülü sohbet
erzurum canlı sohbet sitesi
urfa ücretsiz görüntülü sohbet
A110E
ReplyDeleteKwai Takipçi Satın Al
Dxy Coin Hangi Borsada
Facebook Sayfa Beğeni Hilesi
Bitcoin Kazanma Siteleri
Clysterum Coin Hangi Borsada
Kripto Para Madenciliği Nasıl Yapılır
Soundcloud Reposts Satın Al
Kripto Para Nedir
Kripto Para Çıkarma