0

我已经使用 GUI 桌面应用程序记录了我的测试,HAVE SIKULI CLICK A FLASH BUTTON。

现在我想在 Java 中使用我的 sikuli 脚本,如下所示:

import org.sikuli.script.*;

public class TestSikuli {

public static void main(String[] args) {
    Screen s = new Screen();
    try{

         s.wait("imgs/ViewPlaylist.png");
          s.click("imgs/ViewPlaylist.png", 0);

           s.type(null, "hello world\n", 0);
    }
    catch(FindFailed e){
            e.printStackTrace();
    }

}

但是程序没有运行或显示任何输出。

你可以看看代码并让我的 Java/Sikuli 脚本运行。

谢谢!

4

3 回答 3

1

我相信您现在一定已经完成了,但请仔细检查您是否已遵循此处列出的所有步骤 -

http://sikuli.org/wiki/How%20to%20use%20Sikuli%20Script%20in%20your%20JAVA%20programshttp://sikuli.org/docx/faq/030-java-dev.html

如果是,请提供更多信息,说明您在执行这些步骤时是否有任何问题?

于 2011-10-12T14:31:09.033 回答
0

私人无效点击(字符串图像)抛出 FindFailed{

Screen screen = new Screen();

Pattern pattern = new Pattern(image).similar((float) 0.7);

if(screen.find(pattern)!=null){ 
    screen.mouseMove(pattern); 
    screen.click(pattern); 
}
}

提供图像 URL(本地或网络),此方法应该可以解决问题。它将鼠标移动到屏幕上的指定图像,然后单击它...

于 2014-04-04T13:22:42.580 回答
0

尝试这个

import org.sikuli.script.*;
import org.sikuli.basics.ImageLocator;
 public class TestSikuli {

public static void main(String[] args) {
Screen s = new Screen();
try{
  ImageLocator.setBundlePath("path to img directory");
     s.wait("ViewPlaylist.png");
      s.click("ViewPlaylist.png");

       s.type("hello world\n");
}
catch(FindFailed e){
        e.printStackTrace();
}

}
于 2015-06-26T12:34:14.780 回答