英文:
if condition for java sikuli is not working
问题
我正在使用Java-sikuli编写脚本,并尝试使用以下if条件:
if(screen.exists(gameIsInProgress) != null ||
screen.exists(waitingFormorePlayer) != null) {
screen.click(settingsOnGameWindow);
screen.click(exitRoom);
screen.click(yes);
}
我正在检查图像是否存在,如果存在,然后我点击一些按钮。问题是,即使图像不存在,它仍然在搜索该按钮,这导致了测试失败。
英文:
I am writing scripts using Java-sikuli, and trying to use if condition as follows:
if(screen.exists(gameIsInProgress) != null ||
screen.exists(waitingFormorePlayer) !=null) {
screen.click(settingsOnGameWindow);
screen.click(exitRoom);
screen.click(yes);
}
I am checking whether the image exists, and if - yes, then I click some buttons. The issue is, even if the image does not exist it is searching for that button, which is causing the test to fail.
答案1
得分: 1
RaiMan来自SikuliX:
也许你需要为图像使用更高的分数。
使用SikuliX IDE的预览功能进行检查。
如果图像(例如gameIsInProgress)始终可见但在颜色方面发生变化,可能会发生这种情况。
英文:
RaiMan from SikuliX:
Maybe you have to use a higher score for the images.
Check with the SikuliX IDE Preview feature.
This might happen, if the image (e.g. gameIsInProgress) is always visible, but changes its state with respect to color.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论