← Back to team overview

sikuli-driver team mailing list archive

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:
Since I am RaiMan I always ask:
did you already read through the docs?
http://doc.sikuli.org

some of your questions are basics, that are answered there.

*** how to make sikuli wait for an image
wait(img, time_value_seconds) # FOREVER for unlimited wait

or instaed of 
click(image)
use
click(wait(image, 20))

the given time value in seconds is a maximum wait time for this
individual image search.

You might also use
setAutoWaitTimeout(seconds)

which sets the standard waiting time for all subsequent searches on the screen.
(Be aware: region specific)

*** i want the andrew stay the same but the numbers vary from 1-100
import random
num = randint(1, 100) # each call gives random number
user = "andrew"+str(num)
print user

*** how to make sikuli write in text box?
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
type("a", KeyModifier.CTRL) # select current content (optional)
type(Key.BACKSPACE) # delete content (optional)
type(user) # types the current content of variable user

hope it helps and raises fun with Sikuli

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