0
當我嘗試使用java web驅動程序和sikuli自動化一個帶有flex的網站應用程序時,出現錯誤「java.lang.IllegalThreadStateException:Can not call從事件調度線程」使用下面的代碼Sikuli:java.lang.IllegalThreadStateException:無法從事件分派器線程調用方法
public static void clickImage(String folder, String file) throws FindFailed {
Screen screen;
File loc = new File("images/" + folder + "/" + file + ".png");
Pattern image = new Pattern(loc.getAbsolutePath());
screen = new Screen();
if (isImagePresent(image, 20)) {
try{
waitUntilLoadCompletes(folder);
screen.click(image,0);//This method is throwing error
}catch(Exception e){System.out.println("click has some prblm"+e);}
} else {
new Exception(file+"not found");
}
而且點擊一個按鈕後,我收到以下錯誤以及 [錯誤]鼠標按下方法:按鍵仍然按下 - 使用所有 看起來點擊該圖像,但它不釋放按鈕意味着它按下鼠標按鈕,但不釋放。釋放它引發錯誤的按鈕之前,我想
我使用下面的FN睡眠這是在上面的代碼中使用
public static boolean isImagePresent(Pattern img, int time) {
Screen screen=new Screen();
int i = 0;
while (i < time) {
try {
System.out.println(screen.exists(img).toString());
return true;
} catch (Exception e) {
System.out.println("waiting for image--- "+i+" seconds");
}
i++;
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(Library.class.getName()).log(Level.SEVERE, null, ex);
}
}
return false;
}