if expected image not exists in region/screen then scroll down the list box and see if expected image is present.

Asked by Thanigai

need to iterate through a list box and find the expected image and select the expected image and proceed further.

i have tried without defining a region and had positive scenario like having the expected image without scrolling the list box,

if (exists(Pattern("1549626060889.png").exact()))
click(Pattern("1549626060889.png").exact())
click("1549626309487.png")
else if (exists(Pattern("1549627715270.png").exact()))
click("1549627903114.png")
end
end

Please suggest how to proceed with defining a region and find the content . if not present then i need to scroll down the list box and once again do the same operation.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Thanigai
Solved:
Last query:
Last reply:
Revision history for this message
Thanigai (tvelan23) said :
#1

One more query shall we Pass a Text/string to identify the image in screen? in Find() or exists() method

Revision history for this message
Thanigai (tvelan23) said :
#2

Using do-while-loop i found solution for my problem.

reg = Region(532,225,852,628)
    reg.highlight(5)
    x = 0
   loop do
       if(reg.exists(Pattern("1549894425864.png").exact()))
            reg.click(Pattern("Next_Button.png").exact())
            x = 1
       else if(reg.exists(Pattern("1549894321973.png").exact()))
            reg.click(exists(Pattern("1549894321973.png").exact()))
            reg.click(Pattern("Next_Button.png").exact())
            x = 2
       else
            reg.click("DownArrow.png")
            reg.click("DownArrow.png")
            reg.click("DownArrow.png")
            reg.click("DownArrow.png")
            reg.click("DownArrow.png")
            reg.click("DownArrow.png")
            reg.click("DownArrow.png")
            reg.click("DownArrow.png")
            sleep 2

       end
       end
         break if ((x == 1) or (x == 2))
     end
        puts "HMSS DB is Selected"
        sleep 5
    end