sikuli+java实例

 

新建java工程,导入sikuli-script.jar包

public class TestSikuli {
           public static void openPage() throws FindFailed, InterruptedException {
            Screen s = new Screen();
            //定义图片存放路径
            //方法一 绝对路径
            String imgpath  = "D:\\study\\eclipse\\workspace\\test-sikuli-java\\src\\image\\";
            //方法二  相对路径
            //String  imgpath  = ".\\src\\image\\";
            //双击桌面chrome浏览器图标
            s.doubleClick(imgpath+"chrome.png");
            s.click(imgpath+"baidu.png");            
            Thread.sleep(2000);
            
            //在输入框输入搜索关键字:sikuli,并点击搜索按钮
            
            //s.type(imgpath+"search_input.png", "sikuli");
            s.paste(imgpath+"search_input.png", "sikuli");
            s.click(imgpath+"search_button.png");
            System.out.println("end");        
        }
}

 

运行结果如下: 

[info] Windows utilities loaded.
[info] Sikuli vision engine loaded.
[log] DOUBLE CLICK on (212,1006)
[log] CLICK on (281,80)
[log] CLICK on (364,744)
[log] CLICK on (898,299)
end

  

 

转载于:https://www.cnblogs.com/dieyaxianju/p/5089222.html

你可能感兴趣的:(java,开发工具)