← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #151181]: how to call this recorded script from java

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Nice try - new question - similar answer ;-)

--1. Sikuli scripts are not recorded, they are written in Python
language using the defined Sikuli API according to your wanted workflow.
To write these scripts, you usually use the Sikuli IDE. Scripts can be
run either from within the IDE or from commandline. (see docs and
examples: http://sikuli.org/docx/)

--2. As far as mobile apps are concerned, you write your scripts again
the emulator window on your screen (Sikuli is WYSIWICS --- What you see
is what you can script ;-)

--3. If you plan to program your workflows in Java, you can use the
Sikuli features directly in your code (see:
http://sikuli.org/docx/faq/030-java-dev.html). Principally it is
possible, to "call" existing Sikuli scripts using the Java internal
commandline feature. What you choose depends on your knowledge,
development environment and goals.

--4. your typical use case (as already mentioned) a little bit extended:

openApp("path to your emulator")
click("capture of browser symbol on mobile's home screen")
wait(3) # sufficient to give browser time to start up
paste("gmail.com") # supposing addressfield is selected and ready for input
type(Key.ENTER)
wait("capture of login dialog", 10) # after max 10 seconds script fails
paste("the username") # supposing username field is focused
type(Key.TAB) # supposing one TAB selects password field
paste("the password")
type(Key.ENTER) # fire login
if exists("image of login reject message", 10): # wait max 10 seconds
   print "login not accepted"
else:
   print "login accepted"

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