sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #30653
Re: [Question #262445]: How to check if Screen/Region has not changed after scroll
Question #262445 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/262445
Description changed to:
#SikuliX1.1.0 #Java
Hi RaiMan,
Using sikuli java api, my program tries to scroll a page and look for an
Image(call it target), it scroll down until target found.
// Create a region
Region region = new Screen();
// look for target, if not found scroll down until its found
while (region.exists(targetName, 0) == null) {
region.wheel(Button.WHEEL_DOWN, scrollSteps);
}
// while loop ends when target found, click on target
region.getLastMatch().click();
As you can see it will be an infinite while loop if target is not
present in region.
I am looking for a way through which I could check the contents of a
region "before scroll" and "after scroll" and compare them.
I want to achieve it as
A- Initialize the region in which scroll is required (a webpage or a dropdown/combobox with a scrollbar)
B- capture the region as an image - image1 //Dont know how to
C- find the target in region, if not found, scroll down
D- capture the region as an image - image2 //Dont know how to
E- create a match object of image2 - match2
F- create a Region with match2, region = new Region(match2)
G- if(region.find(image1) is successful) { exit } else { B }
Q1 ) Do we have region.capture() capabilities or somewhat similar that I
can use to capture a region and then compare it with other captured
image.
Q2) if not, how can we check if Region's content has not changed?
Any help is much appreciated.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.