sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #30643
[Question #262445]: How to check if Screen/Region has not changed after scroll
New question #262445 on Sikuli:
https://answers.launchpad.net/sikuli/+question/262445
#SikuliX1.1.0 #Java
Hi RaiMan,
I am trying to find a target in a region that has vertical scrollbar. I tried to achieve this as
// Look for the control in region, if not found scroll down and look again.
Region region = new Screen();
while (region.exists(targetName, 0) == null) {
region.wheel(Button.WHEEL_DOWN, scrollSteps);
}
// Out of loop as control found
region.getLastMatch().click();
As you can see the problem here is infinite while loop if control is not present in region.
I was looking for a way through which if I could check the contents of a region "before scroll" and "after scroll" are same.
Simplest approach I could think but couldn't achieve is
A- create the region where scroll is required (an area for webpage or a dropdown/combobox with a scrollbar)
B- capture the region as an image - image1 //Dont know how to
C- find the control 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 state of region and then compare it with later state.
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.