sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #40099
Re: [Question #390028]: Sikuli automation to pull data from csv and enter in browser app
Question #390028 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/390028
DJ posted a new comment:
Basically the sikuli script should go through the csv and take the data that I designate and add it into my application gui via browser. Basically it is running through the process to create an ID.
I have the sfg_update_profile data in the code now
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()
print("Consumer = " + Consumer + ", Owneremail = " + Owneremail + ", Password = " + Password + ", PreProcess = " + PreProcess + ", Profile = " + Profile + ", RepType = " + RepType + ", Completionemail = " + Completionemail + ", Erroremail = " + Erroremail + ", Commonname = " + Commonname + ")
sfg_update_profile(Consumer, Owneremail, Password, PreProcess, Profile, RepType, Completionemail, Erroremail, Commonname)
if __name__ == "__main__":
main()
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.