简体   繁体   English

我想找到与org.sikuli.api.DesktopScreenRegion类似的API,以验证另一个图像中是否存在一个图像

[英]I want to find a similar API to org.sikuli.api.DesktopScreenRegion to verify if one image exists in another

I'm writing Python code for IOS automation using Appium, but get stuck on this issue: the check point is check some cells in tableView, when changing the device location setting (the cells will be different, both number and text), if the text and image appears in cell correctly, and the image matches the text, like football icon matches "football", I try to find webdriver api to capture the snapshot for the cell only, but all the methods I found are for the driver, it just can capture the whole screen. 我正在使用Appium编写用于IOS自动化的Python代码,但遇到了这个问题:更改设备位置设置时,检查点是检查tableView中的某些单元格(单元格将不同,数字和文本),如果文本和图像正确显示在单元格中,并且图像与文本匹配,例如足球图标匹配“足球”,我尝试找到webdriver api来仅捕获单元格的快照,但是我发现的所有方法都是针对驱动程序的,才可以捕获整个屏幕。

so we found a way to check this: first we capture the correct screenshot for the cells manually, then running the automation script, use the correct cell_screenshot to check if it appears in the screen

now my workmates has the java code for this: 现在我的同事对此具有Java代码:

import org.sikuli.api.DesktopScreenRegion;
import org.sikuli.api.ImageTarget;
import org.sikuli.api.ScreenRegion;
import org.sikuli.api.Target;

public class SnapShot {
    static DesktopScreenRegion sr = new DesktopScreenRegion();
    static Target image;
    static ScreenRegion result;
    static String fileURL;

    private static String getImageURL(String fileURL){
        return "screenshots/" + fileURL; 
    }`enter code here`
    public static boolean imageExists(String fileURL, Double similar, int timeout){
    timeout = timeout * 1000;
    image = new ImageTarget(new File(getImageURL(fileURL)));
    image.setMinScore(similar);
    result = sr.wait(image, timeout);
    if (result == null){
            System.out.println("Can not find image");
            return false;
    }
    return true;
    }
}

this code can use imageExists to judge if the image can be found in another I search for sikuli api for python, but cannot find anything, looks like there's java api only now I'm stuck at this, could anyone help? 这段代码可以使用imageExists判断是否可以在另一个图像中找到该图像。我在python中搜索sikuli api,但是找不到任何东西,看起来只有Java api,现在我被困在这个位置,有人可以帮忙吗? Thanks a lot! 非常感谢!

Sikuli supports Jython as well. Sikuli也支持Jython。 In fact that is default the scripting language for Sikuli. 实际上,这是Sikuli的默认脚本语言。 So you can write similar logic in Jython and then call that script from Python(if at all you can). 因此,您可以在Jython中编写类似的逻辑,然后从Python调用该脚本(如果可以的话)。 I have seen users using Java to call sikuli script. 我已经看到用户使用Java来调用sikuli脚本。 Refer here for Sikuli details. 有关Sikuli的详细信息,请参阅此处

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

相关问题 sikuli中的org.sikuli.api.ScreenRegion错误是什么意思? - What does org.sikuli.api.ScreenRegion error in sikuli means? 使用 opencv 在另一个图像中查找类似图像 - Find similar image inside another image with opencv 我想查找线程消息并使用slack-api将其删除 - I want to find thread message and delete it with slack-api 使用Sikuli验证文本 - Using Sikuli to verify text 使用 opencv 找到包含另一个图像的最相似的图像 - Using opencv to find the most similar image that contains another image Pandas:如果字符串存在于几列中的任何一列中,我想对计数求和,并将此计数添加到具有搜索词的另一个数据框中 - Pandas: I want to sum a count if a string exists in any one of several columns and add this count to another dataframe with the searched term 使用Sikuli验证表中的数据 - Using Sikuli to verify data in a table 试图找出数据框中的一列与另一列的相似程度 - Trying to find how similar one column is to another in dataframe 如何从目录中找到与输入图像相似的图像? - How do I find an image similar to the input image from a directory? 我想从一个数据框中选择其值存在/不存在于另一个数据框中的所有记录。 如何使用 pyspark 数据框执行此操作? - I want to select all records from one dataframe where its value exists/not exists in another dataframe. How to do this using pyspark dataframes?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM