mardi 5 juillet 2016

How to click on some image which occurs multiple times on screen with sikuli with java?

I am writing some script automation in java which searches some recordings for mobile number and finds multiple recording in gridview. Next to this I am trying to download all recordings by clicking download (multiple)button(s). I have written below code but does not work

public static Screen s = new Screen();
Iterator <Match> matches  =s.findAll("downloadbtn_wh.png"); // s is screen
Pattern pButton = new Pattern("downloadbtn_wh.png");

Match mButton;

while (matches.hasNext()) {
    Match m = matches.next(); // m now could be inspected with debugging
    s.click(m); // click on drop-down

    if ((mButton = s.exists(pButton))!=null) {
        // checks for button image and saves the match
        s.click(mButton); // just click the match, do not search again
        break;
    }
}

This script stops after clicking on first download button but I expect that it should click on every download button in gridview. Images

Aucun commentaire:

Enregistrer un commentaire