简体   繁体   English

如果 java sikuli 的条件不起作用

[英]if condition for java sikuli is not working

I am writing scripts using Java-sikuli, and trying to use if condition as follows:我正在使用 Java-sikuli 编写脚本,并尝试使用if 条件如下:

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.问题是,即使图像不存在,它也在搜索该按钮,这会导致测试失败。

RaiMan from SikuliX:来自 SikuliX 的 RaiMan:

Maybe you have to use a higher score for the images.也许您必须为图像使用更高的分数。 Check with the SikuliX IDE Preview feature.检查 SikuliX IDE 预览功能。

This might happen, if the image (eg gameIsInProgress) is always visible, but changes its state with respect to color.如果图像(例如 gameIsInProgress)始终可见,但在颜色方面改变了其 state,则可能会发生这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM