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

I am trying to automate application data entry into a application on firefox 
web browser using sikuli. I am pulling data from a csv and entering that data 
into a application gui on firefox web browser. My current sukili script is 
built but when I run it nothing happens it does not switch to the web browser 
and start the data entry from the csv. Any help would be appreciated. I'm 
missing something but I am not seeing it.
Below is my sikuli script

import csv
import sys

########################################################################################################################
# Config
########################################################################################################################

SFTPProfileCSV = 'C:/Users/w299833/Downloads/FGinfoforSikuli.csv'

# browser='Windows Internet Explorer'
browser = 'Mozilla Firefox'

#What order the protocol is in, in the custom protocol list
orderOfCustomProtocol=11
timeBetweenScreens = 5  # How many seconds till the next screen draws

### Screen you should be on is Participants>Partners and cursor should be in 
the search box, then you can run sikuli script #####

########################################################################################################################
# Basic / Keyboard functions
########################################################################################################################
def type_up(n):
    while(n > 0):
        type(Key.UP)
        n = n - 1

def type_down(n):
    while(n > 0):
        type(Key.DOWN)
        n = n - 1

def type_tab(n):
    while(n > 0):
        type(Key.TAB)
        n = n - 1

def type_shift_tab(n):
    while(n > 0):
        type(Key.TAB, KEY_SHIFT)
        n = n - 1
        
########################################################################################################################
# SIKULI SCREEN AUTOMATION
########################################################################################################################
def sfg_update_profile(Producer, Clientname, BU, Owneremail, Password):
    switchApp(browser)

    #Get from the landing page on "Partners" screen to the "Edit Partner" screen

    #We are required to have the partner filter box selected and empty
    type_tab(3)
    type(Key.ENTER)
    sleep(timeBetweenScreens)
    
    #Add Partner
    type_tab(1)
    type(Key.DOWN)
    type_tab(1)
    type(Key.ENTER)
    sleep(timeBetweenScreens)
    
    #Add Partner Information
    type_tab(1)
    paste(Producer)
    type_tab(1)
    paste(Producer)
    type_tab(1)
    paste(Clientname)
    type_tab(2)
    paste(BU)
    type_tab(3)
    paste(NA)
    type_tab(3)
    paste(Owneremail)
    type_tab(2)
    type(Key.ENTER)
    sleep(timeBetweenScreens)
    
    #Add Partner User Account
    type_tab(2)
    paste(Producer)
    type_tab(1)
    paste(Password)
    type_tab(1)
    paste(Password)
    type_tab(1)
    type(Key.DOWN)
    type_tab(2)
    paste(Producer)
    type_tab(1)
    paste(Producer)
    type_tab(2)
    type(Key.ENTER)
    sleep(timeBetweenScreens)
    
    #Add Partner Partner Role           
    type_tab(1)
    type(Key.Space)
    type_tab(1)
    type(Key.Space)
    type_tab(2)
    type(Key.ENTER)
    
    #Finish Screens no changes
    type_tab(3)
    type(Key.ENTER)
    type_tab(2)
    type(Key.ENTER)
    type_tab(3)
    type(Key.ENTER)
    
    #Close the edit community tab
    type("w", Key.CTRL)
    sleep(timeBetweenScreens)
    
    #Get back to where we can paste the next partner
    type_shift_tab(4) 
    
########################################################################################################################
# MAIN
########################################################################################################################

def main():
    RowStart = int(input("What row number in the FTP file \nshould I START 
with?"))
    RowEnd = int(input("What row number in the FTP file \nshould I END with?"))
    RowStart = RowStart -1 #CSVs are zero initialized but we're skipping the 
title row

        # Open file for reading, as a text file = rU
    # csvFileGuy = (open(SFTPProfileCSV, 'rU'))


    profiles = []
    with open(SFTPProfileCSV, 'rU') as csvFileGuy:
        reader = csv.reader(csvFileGuy)
        for row in reader:
            profiles.append(row)
            # print(row)

    for n in range(RowStart, RowEnd):
        Producer = str(profiles[n][0]).strip()
        Clientname = str(profiles[n][2]).strip()
        BU = str(profiles[n][3]).strip()
        Owneremail = str(profiles[n][4]).strip()
        Password = str(profiles[n][5]).strip()

if __name__ == "__main__":
    main()


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to