[英]getting find failed errors in sikuli
getting this error while running sikulix with eclipse使用 Eclipse 运行 sikulix 时出现此错误
18:31:08:751 >> Loading HP UFT Java Support (version 12.0.0.0) (SUN 1.7.0)
Exception in thread "main" FindFailed: Capture.PNG: (408x284) in S(0)[0,0 1366x768] E:Y, T:3.0
Line 2759, in file Region.java
at org.sikuli.script.Region.wait(Region.java:2759)
at org.sikuli.script.Region.find(Region.java:2336)
at org.sikuli.script.Region.getLocationFromTarget(Region.java:3213)
at org.sikuli.script.Region.click(Region.java:3698)
at org.sikuli.script.Region.click(Region.java:3683)
at ab.main(ab.java:15)
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files (x86)\HP\Unified Functional Testing\bin\java_shared\classes";"C:\Program Files (x86)\HP\Unified Functional Testing\\bin\java_shared\classes\jasmine.jar"
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
The code is:代码是:
ImagePath.setBundlePath("C:/Users/xw66/workspace/Sikul/imgs");
Screen s = new Screen();
//s.wait();
s.doubleClick(new Pattern("C:/Users/xw66/workspace/Sikul/imgs/abc.PNG"));
// s.click(getData("ImagePath"+"Capture.PNG"));
Screenshots taken by Sikuli IDE works fine. Sikuli IDE 截取的屏幕截图工作正常。 But if you are taking screenshot by (cmd+shift+4) in macbook pro, resolution of the image is 144 pixel.
但是如果你在macbook pro中通过(cmd+shift+4)截图,图像的分辨率是144像素。 1. Reduce the pixel size.
1.减小像素大小。 2. Right click on image > open with > Preview 3. A popup will open.
2. 右键单击图像 > 打开方式 > 预览 3. 将打开一个弹出窗口。 4. Click on Tools > Adjust Size > Make Resolution to 72 and click on Ok.
4. 单击工具 > 调整大小 > 将分辨率设为 72,然后单击确定。 Now the image will work fine.
现在图像可以正常工作了。
@radhi I know its late to reply, but its better to follow the below instructions when using sikuli @radhi 我知道回复晚了,但是在使用 sikuli 时最好遵循以下说明
Install/Setup sikuli from the sikuli jar file < https://launchpad.net/sikuli/+download >, even if you are using the maven dependency, i would still suggest you to do so从 sikuli jar 文件 < https://launchpad.net/sikuli/+download > 安装/设置 sikuli,即使您使用的是 maven 依赖项,我仍然建议您这样做
Run a small script from the IDE to make sure things work fine从 IDE 运行一个小脚本以确保一切正常
Coming to capturing the images, i have seen that if i use the default screen capture present (CMD + SHT + 4) in Macbook Pro Retina display and the same from the Sikuli IDE, the IDE's image work.在捕获图像时,我发现如果我在 Macbook Pro Retina 显示屏中使用默认屏幕捕获 (CMD + SHT + 4),并且在 Sikuli IDE 中使用相同的屏幕捕获,则 IDE 的图像工作。 So its better to take images from Sikuli IDE, save the file and unzip the .sikuli file or in Mac, just right click > show package content.
所以最好从 Sikuli IDE 获取图像,保存文件并解压缩 .sikuli 文件,或者在 Mac 中,只需右键单击 > 显示包内容。
Take the images and use them.拍摄图像并使用它们。 This was what solved this issue for me.
这就是为我解决这个问题的原因。
If this does not help, Debug the script at the point where you are accessing the image and check if the fileUrl is pointing to the correct location如果这没有帮助,请在您访问图像的位置调试脚本并检查 fileUrl 是否指向正确的位置
Sometimes taking pictures using sikuli IDE works, but for me it was still not working.有时使用 sikuli IDE 拍照可以,但对我来说仍然无法正常工作。
So I found that the problem was resolution with my laptop, I was having a higher resolution which was causing problem.所以我发现问题是我的笔记本电脑的分辨率,我的分辨率更高,这导致了问题。
So I reduced my resolution of my laptop from 1920 x 1080 ( too high for Sikuli) to a lower resolution所以我将笔记本电脑的分辨率从 1920 x 1080(对 Sikuli 来说太高)降低到了较低的分辨率
1280 x 720 and now it works like a charm. 1280 x 720 ,现在它就像一个魅力。
So try reducing resolution of your system因此,请尝试降低系统的分辨率
Just tried the Sikuli very recently and had the same Find Failed Exception issue happened.最近刚刚尝试了 Sikuli,并且发生了相同的 Find Failed Exception 问题。 OS -Windows 10 Solution: I tried to change the Display settings-->scale and layout--> Change the size of text, apps and other items to 125% (it was basically 150%) Display resolution 1920*1080 still works
操作系统 -Windows 10 解决方法:我尝试更改显示设置-->缩放和布局-->将文本、应用程序和其他项目的大小更改为 125%(基本上是 150%) 显示分辨率 1920*1080 仍然有效
PS: So just be careful when you get this issue check your resolution which works best for your physical monitor. PS:因此,当您遇到此问题时请小心检查最适合您的物理显示器的分辨率。 Also try to check in separate laptop with the same code, if the current one is still having issues.
如果当前的笔记本电脑仍有问题,请尝试使用相同的代码签入单独的笔记本电脑。 So if it works on other laptop all you need to do is replicate the Display settings it should work and it worked for me.
因此,如果它可以在其他笔记本电脑上使用,您只需复制它应该可以使用的显示设置,并且对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.