Archive for the ‘Scripts for Testing’ Category:
Export a .csv file using web.py – (python:))
This script is for Exporting a csv file and get the browser to recognize that its a csv file and popups the download window with web.py. Lets say we have a database with a table called users and you want to create a csv file that contains all the users with their names and id’s here is how you do it.
class export:
def GET(self):
i = web.input()
users = web.select(’users‘, vars=locals())
csv = []
csv.append(”id,name\n“)
for user in users:
row = []
row.append(user.id)
row.append(user.name)
csv.append(”,“.join(row))
#writer.writerow(row)
#f.close()
web.header(’Content-Type‘,’text/csv‘)
web.header(’Content-disposition‘, ‘attachment; filename=export.csv‘)
print “”.join(csv)
return
Script to see if Perl is working ! :E !

There are 2 ways to Test if Perl is working properly on your system. More »
Data Driven testing using selenium !
This post will also be in the new blog dedicated to Selenium <- coming soon
You will have to record your script using Selenium IDE in firefox browser
Then export the script in any of the programming languages in which you are comfortable….(Hope you know how to export since you are using that tool now, that’s why you are reading this post
) More »

