File Uploading using SikuliX

Sikuli is a visual technology to automate graphical user interfaces (GUI) using images (screenshots). Sikuli Script automates anything you see on the screen without internal API's support. You can programmatically control a web page, a desktop application running on Windows/Linux/Mac OS X, or even an iPhone or Android application running in an emulator.

Download SikuliX

The only file you need to download is sikulixsetup-1.1.1-#timestamp#.jar:

(download by clicking this link, store in an preferably empty folder and run by double clicking the jar)
sikulixsetup....jar
(on Linux it might be necessary to switch on the executable file attribute)

this setup jar and the other jars look like this after download:
sikulix...-1.1.1-YYYYMMDD.SSSSSS-NN-forsetup.jar or
sikulix...-1.1.1-YYYYMMDD.SSSSSS-NN.jar
DO NOT rename the files - leave them as they are!

The sikulixsetup....jar, sikulix.jar and sikulixapi.jar can be moved where ever you want.

Execute jar file from Command Prompt:
java -jar sikulixsetup-1.1.1-20170115.001619-83-forsetup.jar















Facebook Login using SikuliX:
package com.sikulix.test;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Screen;

public class FacebookLogin {

 public static void main(String[] args) throws FindFailed {
  WebDriver driver = new FirefoxDriver();

  driver.manage().window().maximize();
  driver.get("http://www.facebook.com");
  
  Screen sc = new Screen();
  String fileLoc = "J:/Softwares/SikuliX/SikuliXImages/";
  
  sc.type(fileLoc + "UserName.PNG", "abcdefg@gmail.com");
  
  sc.type(fileLoc + "Password.PNG", "password123");
  
  sc.click(fileLoc + "Login.PNG");
 }
}


File uploading Using SikuliX:
package com.sikulix.test;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Key;
import org.sikuli.script.Screen;
import org.testng.annotations.Test;

public class FileUploading {

 @Test
 public void fileUploading(){
  try {
   WebDriver driver = new FirefoxDriver();

   driver.manage().window().maximize();
   driver.get("http://anish-selenium.blogspot.in/p/file-uploading-using-sikulix.html");
   
   driver.findElement(By.id("myFile")).click();
   
   Screen sc = new Screen();
   sc.keyDown(Key.CAPS_LOCK);  
   sc.keyUp(Key.CAPS_LOCK);
   String location = "J:/Softwares/SikuliX/SikuliXImages/";
   
   sc.type(location + "FileName.PNG", "C:\\Users\\SIDHARTH\\Desktop\\input.xls");
   
   sc.click(location + "Open.PNG");
   
   Thread.sleep(5000);
   sc.keyDown(Key.F5);
   sc.keyUp(Key.F5);
   
  } catch (FindFailed | InterruptedException e) {
   e.printStackTrace();
  }
 }
}

No comments:

Post a Comment