def save_forms(filename): forms = browser.get_all_forms() stream = open(filename, "w") for i, form in enumerate(forms): print_form(i, form, stream) stream.close()
def show_forms (self, url, filename="forms"): if url: try: self.commands.go(url) except: print "There is a problem with the URL" forms = self.commands.get_browser().get_all_forms() stream = open(filename, 'w') for i, form in enumerate(forms): print_form (i,form,stream) else: sc = "Please provide the URL"