← Back to team overview

sikuli-driver team mailing list archive

[Question #392628]: reading a csv file to log in

 

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

Hi there,
 I have a csv file that looks like this

username1, password1
username2,password2
username3,password3

my script does this

import csv
fname="username.csv"
f = open(fname)
counter = 0
for line in f.readlines():
    email, password = line.strip().split(",")
    counter +=1
    print email, password, counter

# script then attempts to log in using the first username and password
# Do Stuff
# Logout and hen log in as second user and repeat 
#Logout and then log in as third user and repeat
#logout


f.close()      
        

What happens is when I run the script it does this


username1 password1 1
username2 password2 2
username3 password3 3

Then it goes to log in but it logs in as the third user and not the first... I know this is a simple mistake that I am making as I am a novice.

What I am expecting to happen is

1. Open file
2. Read first row of file
3. Login and perform tasks
4. logout
5. Read second row of file
6. Login and perform tasks
7. logout
8. Read third row of file
9. Login and perform tasks
10. logout

Thank you !

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