How can i find the form name without "nr=0"

scripteaze scripteaze at gmail.com
Mon Nov 5 18:05:36 CET 2007


On Nov 5, 8:52 am, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> scripteaze wrote:
> > Im using mechanize method for retrieving the form so that i may log
> > into it. I need to find a way to get the form name. Its not listed
> > anywhere in the html source.The reason i need to do this is because im
> > tryin not to use the for loop below. Someone told me that the form
> > name should be listed in the 'print form' portion of the codes output.
> > I dont believe the form name is listed there also. Any ideas/help
> > would be great. Thank you in advance for your time.
>
> >             for form in self._br.forms():
> >                 print form
> >                 self._br.select_form(nr=0)
> >                 self._br['username'] = Crawler.usrname
> >                 self._br['password'] = line.strip()
> >                 response=self._br.submit()
> >                 if 'incorrect' in response.read():
> >                     print 'password incorrect =', line.strip()
>
> How do you expect the form to be named if there is no name given in the HTML
> source?
>
> Diez- Hide quoted text -
>
> - Show quoted text -

Well, i wasnt sure if you could have a form without a form name, i was
just thinking that it had one but maybe hidden and that i could
retrieve it




More information about the Python-list mailing list