条件语句在Java Sikuli中不起作用。

huangapple go评论129阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年8月11日 21:13:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/63358913.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定