← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #235672]: Validating a dropdown list

 

Question #235672 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/235672

    Status: Open => Answered

RaiMan proposed the following answer:
Just make a shot of the current drop down entry field before Key.DOWN, then type Key.DOWN and then compare the shot made before with the current content of the match region:
if equal, you are at the end, if not, some fields are left.

field = Region(<some how evaluate the (field) region to observe>)

# the following snippet will be somewhere inside a loop

imgField = capture(field) # now you have saved the image before KeyDown
type(Key.DOWN)
if field.exists(Pattern(imgField).exact(), 0):
    print "the end is reached"
    break
else:
    continue # her you have to do something and go back to top of loop

Since you say you are familiar with Python, I did not write exact code,
hoping you get it

comment on exists(<some image>, 0):
The 0 tells Sikuli, to come back immediately after the first image search and not wait the standard 3 seconds if not found.

Hope you are using the new version 1.0.1 ;-)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.