← Back to team overview

sikuli-driver team mailing list archive

[Question #213012]: Using iterators with methods?

 

New question #213012 on Sikuli:
https://answers.launchpad.net/sikuli/+question/213012

WHen i wrote some test cases using Watir(Ruby) i was able to create a method for creating a client in my software. with in that method i was able to embed an iterator so that later i could say create this client 9 times and for every instance of that client add a number to the end. the end result was i had 9 clients named:

client 1
client 2
client 3
client 4 

and so on. i had to do this because I can not have duplicate names as our software doesnt allow it.

now using Sikuli/jython, I'm confused on how to perform this same task.

I have a method created for creating a client.

its just defined: (example)

from sikuli import*

def create_client():
    type("n", KeyModifier.ALT)
    type("i")
    type("n", KeyModifier.CTRL)
    wait("IZI1IClassif.png")
    paste("Sikuli Test Client")
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.ENTER)
    paste("Sikuli Test Client Full Name")
    type(Key.TAB)
    paste("Address1")
    type(Key.TAB)
    paste("Address2")
    type(Key.TAB)
    paste("Address3")
    type(Key.TAB)
    paste("City")
    type(Key.TAB)
    paste("State")
    type(Key.TAB)
    paste("ZIP")
    type(Key.TAB)
    paste("Country")
    type(Key.TAB)
    type(Key.TAB)
    paste("555-555-5555")
    type(Key.TAB)
    type(Key.TAB)
    paste("555-555-5555")
    type(Key.TAB)
    type(Key.TAB)
    paste("555-555-5555")
    type(Key.TAB)
    type(Key.TAB)
    paste("555-555-5555")
    type(Key.TAB)
    type(Key.TAB)
    paste("example@xxxxxxxxxxx")
    type(Key.TAB)
    paste("example@xxxxxxxxxxx")
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type("In reference to field")
    type("s", KeyModifier.CTRL)
    waitVanish(Pattern("1351792567535.png").similar(0.98))
    keyDown(Key.CTRL)
    type(Key.F4)
    keyUp(Key.CTRL)




how can i take this method and say run 9 times but not loop it as i don't want the same 9 clients, I want 9 clients with 1,2,3 etc added to the end of the client name

thanks in advance for any help you can provide!

Shawn

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