Finding an image/object inside a captured image

Asked by Varun Gupta on 2017-07-20

I have requirement, to work with tree structure using Sikuli(1.1.0) with Java

On the Application Under Test, we have multiple expand buttons(+) with unique labels.
Using Sikuli I am able to identify the lables along with expand button(+).

As per my requirement I want to click on expand button(+) containing particular label, I tried with following code to find expand button(+) using the image which is captured with label & expand button.

        Settings.MinSimilarity = 0.5;
        int x = s.find("Label1.PNG").getX();
        int y = s.find("Label1.PNG").getY();
        int w = s.find("Label1.PNG").getW();
        int h = s.find("Label1.PNG").getH();
        Region abc = s.setRect(x, y, w, h);
        abc.click("expand.PNG");

While running, I am getting following error:
Exception in thread "main" FindFailed: can not find C:\expand.PNG in S(0)[0,0 1600x900]
  Line 2189, in file Region.java

 at org.sikuli.script.Region.handleFindFailedShowDialog(Region.java:2189)
 at org.sikuli.script.Region.handleFindFailed(Region.java:2134)
 at org.sikuli.script.Region.wait(Region.java:2546)
 at org.sikuli.script.Region.find(Region.java:2205)
 at com.aa.bb.cc.dd.ee.ff(TEST.java:62)
 at com.aa.bb.cc.dd.ee.ff(TEST.java:26)

Is it possible to find inside object of the image if yes,please share the information?

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2017-07-20
Last reply:
2017-07-20
RaiMan (raimund-hocke) said : #1

this is the normal way:

Match label = s.find("Label1.PNG");
label.click("expand.PNG");

"expand.PNG" is searched in the Region defined by the Match label.

Can you help with this problem?

Provide an answer of your own, or ask Varun Gupta for more information if necessary.

To post a message you must log in.