← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #701089]: Cannot verify an object on screen

 

Question #701089 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/701089

    Status: Answered => Open

Ioannis is still having a problem:
Thank you for your answer. I really have no issues with image paths, I
know that because I have already save 'em as files to check this
situation out, when debugging. I think my issue is with the different
screen sizes. I take a screenshot from a screen and compare it to
another image which is different resolution. I take my images files as
follow, I am posting the full code now I have my laptop with me :)

public static boolean imageExist(String kind, String fileName, int secondsWait) {
        Settings.MinSimilarity = Double.parseDouble(SerenityProperties.read("sikuli.similarity"));

        //Object to be found
        URL path = SikuliRemote.class.getClassLoader().getResource("Sikuli/" + kind + "/" + fileName);
        String absolutePath = path.getPath();

        try {
            File screenshotFile = ((TakesScreenshot) Serenity.getDriver()).getScreenshotAs(OutputType.FILE);
            Finder finder = new Finder(screenshotFile.getPath());

            finder.find(absolutePath);
            if (finder.hasNext()) {
                System.out.println("Object found.");
                return true;
            }
        } catch (Exception e) {
            SerenityUtilities.logMessage("Cannot get a screenshot");
        }

        return false;
    }

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.