Reputation: 1349
Hi I using mechanize test framework here i am running this script to test a page its working fine if i have only one page
import mechanize
class Transaction(object):
def run(self):
br = mechanize.Browser()
br.set_handle_robots(False)
resp = br.open('http://www.example.com/')
resp.read()
now i have 15 urls and i want to read them from a file and want to put them in this place
resp = br.open('http://www.example.com/')
but i am not able to do this because as run method runs multiple times and give response that i am not able to handel
May be i am not too much clear please have look on this discription
http://testutils.org/multi-mechanize/scripts.html
I am very new to python so i am not able to handel this tried google searching but haven't found any solution.
Upvotes: 1
Views: 832
Reputation: 91
You should create an (global) array of the websites in init() which is only called once and then you can write a for loop to open each of the websites in the array.
Upvotes: 1