sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #41564
Re: [Question #464137]: How to select from a slider list that contains more than 10 values
Question #464137 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/464137
Status: Open => Answered
RaiMan proposed the following answer:
normally I do not make scripts any more for specific user requests, but
this case was interesting for me, since it currently fits perfectly as a
testcase for version 2 and I will put it as an example into the docs -
so you are welcome in this case:
# the script macSelectLanguage.sikuli
# images used
showAll = "showAll.png"
language = "language.png"
german = "german.png"
english = "english.png"
# open or focus System Preferences
App.open("System Preferences")
# to make sure the all view is visible
click(showAll)
wait(1)
# select language view
click(language)
wait(1)
# waiting for language tab
topRef = wait(Pattern("language.png").targetOffset(29,100))
#topRef.highlight(2)
# restrict search reagion to list area
list = topRef.left(1).right(250)
list = list.below(1).below(300)
#list.highlight(2)
# find entry
entry = list.exists(english)
if (entry):
topRef.hover()
# remember top position
topLoc = Mouse.at()
wait(1)
entry.hover()
# remember entry position
entryBackLoc = Mouse.at().offset(0, entry.h/2)
else:
print "entry not visible in list"
exit(1)
# check if entry is already at top position
if not entry.y > topLoc.y + entry.h/2:
print "already top"
exit()
# move selected entry to top of list
entry.click()
wait(1)
dragDrop(entry, topLoc)
wait(2)
# move entry back to its former position
dragDrop(topLoc, entryBackLoc)
# close System Prefs
wait(3)
type("q", Key.CMD)
# download from here
http://snippets.sikuli.de/examples/macSelectLanguage.sikuli.zip
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.