sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #26830
Re: [Question #251158]: Finding an image inside another image
Question #251158 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/251158
Status: Open => Answered
RaiMan proposed the following answer:
Using Sikuli, you have to think in regions (areas on screen, where you
want to click or search for the next image) and not in images.
Your approach does not really make sense and has the following problem:
click(img)
again searches img on the whole screen and hence finds any target.
so let's work with regions:
so you first get the region, that contains your section head:
head = find(Pattern("image of head of section").exact())
this returns the match, which is the region, where the header image was
found on the screen.
Since it is the head of a section, we can use it to evaluate the area of the section.
The best case: head exactly has the width of the section:
section = head.below(300) # 300 as example denotes the height of the section excluding head
now we can use
section.click(img)
which should click the intended target
things get a bit more complicated, if head does not have the width and position to exactly "head" the section region below.
Then you might use
section = Region(x, y, w, h)
and evaluate the region parameters before based on head, so they fit.
So in the best case the solution simply is:
section = find(Pattern("1404391924018.png").exact()).below(300)
section.click("1404391991766.png")
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.