sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #15598
Re: [Question #219333]: random text writing and making sikuli wait
Question #219333 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/219333
Status: Open => Answered
RaiMan proposed the following answer:
--- putting #2 and #3 together
import random
num = randint(1, 100) # each call gives random number
user = "ALBERT"+str(num)
print "Name =", user
# now user contains "ALBERTNN" where NN is between 1 and 100
# e.g. ALBERT55
# now we make the input field ready
# you have to use an image near the text field and in IDE Preview (click on image thumbnail)
# set the target offset, so the click point is inside the text field.
click(image_with_target_offset) # positions caret in field
# now we use type(), to type in the text contained in user
type(user)
the additional type()'s are only for the case, that you want to empty
the field before typing new stuff.
type("a", KeyModifier.CTRL) # select current content (optional)
type(Key.BACKSPACE) # delete content (optional)
*** script without comments (supposing field is empty)
import random
num = randint(1, 100)
user = "ALBERT"+str(num)
print "Name =", user
click(image_with_target_offset)
type(user)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.