2017-08-11 15 views
1

に私はSikuliとEclipseを使ってMac上でデスクトップアプリケーションを自動化しようとしています。"画像は無効ですが、TextSearchはオフになっています!"エラー - Sikuliは、Mac

ソースコード:

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

public class TextEditorExample { 

public static void main(String[] args) throws FindFailed { 
// TODO Auto-generated method stub 
Screen s=new Screen(); 
System.out.println(ImagePath.getBundlePath()); 
s.click("spotlight_icon.png"); 
s.find("spotlight.png"); 
s.type("spotlight.png","finder"); 
s.click("applications.png"); 
s.click("texteditor_icon.png"); 
s.find("texteditor.png"); 
s.type("texteditor.png","Sikuli Example"); 

} 
} 

しかし、私は次のエラーを取得しています:sikuliスクリプトの

[error] Image: Image not valid, but TextSearch is switched off! 
[error] RunTimeAPI: Wait: Abort: unknown 
[error] RunTimeAPI: ImageMissing: spotlight_icon.png 

パス:画像の

/Users/adamin/Desktop/Automation/SikuliExample/src/TextEditorExample.java 

はパス:

/Users/adamin/Desktop/Automation/SikuliExample/src/spotlight_icon.png 
/Users/adamin/Desktop/Automation/SikuliExample/src/spotlight.png 
/Users/adamin/Desktop/Automation/SikuliExample/src/applications.png 
/Users/adamin/Desktop/Automation/SikuliExample/src/texteditor_icon.png 
/Users/adamin/Desktop/Automation/SikuliExample/src/texteditor.png 

誰でもこの問題の解決に手伝ってもらえますか?

答えて

1

のImagePathは、プロジェクトのルートフォルダにデフォルトで設定されており、そこだけのパターンを探します。また

ImagePath.setBundlePath("fullpath"); 

、によって返されるどんなフォルダにファイルを配置します:

System.out.println(ImagePath.getBundlePath()); 
0

使用パターンちょうどあなたのファイルがどこにいても、手動にバンドルパスを設定します。

Pattern pattern = new Pattern(path+"spotlight_icon.png"); 
Screen s=new Screen(); 
     try { 
      s.click(pattern); 
     } catch (FindFailed e) { 
      e.printStackTrace(); 
     } 
0

このエラーはおそらく

try{ 
    String path = "path of your image"; 
    Pattern target = new Pattern(path); 
    Screen scr = new Screen(); 
    scr.click(target); 
    } 
    catch(Exception e) 
    { 
     e.printStackTrace(); 
    } 

が Y

イメージがロード可能でない場合、一方、

このアプローチを使用しています
関連する問題