sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #49878
Re: [Question #677011]: VNCScreen.wait() does not catch image change
Question #677011 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/677011
Status: Open => Answered
RaiMan proposed the following answer:
I have no idea, what your problems are.
My test with the latest build 1.1.4: (transscripted to my habits)
The image to search for is seen near the top of the remote screen.
//public Match waitForImage(VNCScreen vnc_old, String image, Region reg, double waitTimeout, float score) {
//System.out.println("Waiting for image: " + image + " in a specific region: " + reg.getX() + ", " + reg.getY() + " " + reg.getW() + "x" + reg.getH());
VNCScreen.startUp(0); //do not wait after start (standard would be 3 secs)
VNCScreen vs = VNCScreen.start("192.168.2.121");
Region reg = new Region(0, 0, 1600, 300);
vs.setRect(reg.x, reg.y, reg.w, reg.h);
String vimg = "vncChrome";
Pattern pat = new Pattern(vimg);
//pat.similar(score); //match score is > 0.99 ;-)
Match found = null;
try {
found = vs.wait(pat); //standard waiting 3 secs
// System.out.println("Match: " + found.getScore());
// System.out.println("Found image region: " + found.x + "," + found.y + " " + found.w + "x" + found.h);
p("found: %s", found); //my formatting print function
} catch (FindFailed e) {
log(-1, "not found: %s", pat); // class Debug
// e.printStackTrace();
// screenShot(vs, reg);
// throw new RuntimeException("Failed to find a match for image and click it. " + image);
}
//vs.hover(); // printing found region coordinates
//return found;
// }
The printout when using setRect():
found: M[836,3 74x88]@S(NonLocal, 1280x300) S:1,00 C:873,47 [158 msec]
the search-time will be about 1 sec with fullscreen (no setRect())
BTW: setRect() is not recommended for restricting the search region for one search.
Better is to use the class Region:
Region reg = vnc.newRegion(givenRegion); // dedicates the Region to the given VNCScreen
found = reg.wait(image);
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.