Thursday, July 18, 2019

Create a Word Document using Sikuli using Java

To Download SIKULI JAR and IDE


  • https://launchpad.net/sikuli/+download - https://launchpad.net/sikuli/+download
  • SIKULI - GUI to identify the image and prepare script
    • Sikuli-IDE-win32-0.10.2.exe
    • In case the above file is available, you can download latest version IDE as well.

  • SIKULI JARs
    • sikuli-setup.jar (once you double click the file, you will get - sikulixapi.jar) i.e, below file.
    • sikulixapi.jar
    • Add this JAR into Eclipse in External JAR

Info: Sikuli tech used to create new WORD document and store it in specific path.
Finally closing it.

/**
 * @author Mano
 *
 */
package javaselenium;
import java.awt.AWTException;
import java.awt.Robot;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import org.sikuli.script.FindFailed;
import org.sikuli.script.Key;
import org.sikuli.script.Screen;

public class OpenMSOfficeUsingSikuli {

public static void main(String[] args) throws AWTException, FindFailed {
   
    Robot robot = new Robot();
    Screen sSikuli = new Screen();
       
        //Window Application using Sikuli     
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickStartButton.png");
        robot.delay(1000);
        sSikuli.type("MS Word");
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\ClickMSWord.png");
        robot.delay(1000);
       
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\ClickBlankDocument.jpg");
        robot.delay(1000);
        DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");  
        LocalDateTime now = LocalDateTime.now();
        sSikuli.type("This is Testing program, using SIKULI !! - Now the time is :"+now);
        robot.delay(1000);
       
        sSikuli.doubleClick("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickThisWord.png");
        robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickBoldButton.png");
        robot.delay(1000);
       
        sSikuli.doubleClick("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickISWord.png");
        robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickItalicWord.png");
        robot.delay(1000);
       
        sSikuli.doubleClick("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickTestingWord.png");
        robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickUnderlineWord.png");
        robot.delay(1000);
       
        sSikuli.doubleClick("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickProgramWord.png");
        robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickStrikeButton.png");
        robot.delay(1000);
       
        sSikuli.doubleClick("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickUsingWord.png");
        robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickSubsetButton.png");
        robot.delay(1000);
       
        sSikuli.doubleClick("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickSIKULIWord.png");
        robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickSupersetButton.png");
        robot.delay(1000);
       
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickFileMenu.png");
        robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickSaveButton.png");
        robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickBrowseButton.png");
    robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\selectToTypePath.png");
        robot.delay(1000);
        sSikuli.type("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp");
        robot.delay(1000);
       
        sSikuli.keyDown(Key.ENTER);
        robot.delay(1000);       
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\clickSavePopupButton.png");
        robot.delay(1000);
        sSikuli.click("E:\\Mano\\Java Selenium\\Sikuli\\WindowsApp\\closeWindowButton.png");       
    }


}

No comments:

Post a Comment

Popular Posts