1

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.