title: mechanize: Why does my form list only contain 1 element?
body: <p>I'm new to mechanize and also not the most advanced python user, but I want to automize a task in which I want to give a webpage an input. Problem is now, that the "submit" Button has no control name assigned to it. So I researched a bit and found a way to set a value to the form in question. But to do this I have to access the specific form I want to assign a value to. So my code looks like this:</p>
  
  <pre><code>forms = [f for f in br.forms()]
  print forms[0].controls[0].name
  </code></pre>
  
  <p>I just thought I could access the form by write <code>forms[x]</code> and then something like:</p>
  
  <pre><code>forms[x].set_value("VALUE", 
                         nr=5)
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>    forms[54].set_value("VALUE",nr=100)
  IndexError: list index out of range
  </code></pre>
  
  <p>This might be a bit of a stupid question and possibly arises from the fact that I don't really understand the functions I'm using but since there is no real documentary I would really appreciate a sentence of help here.</p>
  
  <p>PS: I can print all the forms using</p>
  
  <pre><code>for f in br.forms():
      print f
  </code></pre>
  
  <p>with output:</p>
  
  <pre><code> &lt;CheckboxControl(lookup=[yes])&gt;
    &lt;TextControl(fld=NoName)&gt;
    &lt;TextControl(pixemail=)&gt;
    &lt;IgnoreControl(&lt;None&gt;=&lt;None&gt;)&gt;
    &lt;TextControl(ra=00 00 00.0)&gt;
    &lt;TextControl(dec=00 00 00.0)&gt;
    &lt;SelectControl(equinox=[*J2000.0, B1950.0])&gt;
    &lt;TextControl(offra=0.0)&gt;
    &lt;TextControl(offdec=0.0)&gt;
    &lt;TextControl(epoch=2000.0)&gt;
    &lt;SubmitControl(&lt;None&gt;= Retrieve Data ) (readonly)&gt;
    &lt;RadioControl(cextract=[*rect, circle])&gt;
    &lt;TextControl(rawid=10.0)&gt;
    &lt;TextControl(decwid=10.0)&gt;
    &lt;SelectControl(wunits=[Degrees, *Minutes, Seconds])&gt;
    &lt;TextControl(cirrad=10.0)&gt;
    &lt;SelectControl(cat=[UCAC 2, UCAC 3, NOMAD, *USNO B1.0, USNO A2.0, ACT])&gt;
    &lt;SelectControl(surims=[None, *All Surveys, POSS-I (103aO, 103aE), POSS-II (IIIaJ, IIIaF, IV-N), SOUTH, AAO-R, POSS-IO, POSS-IE, POSS-IIJ, POSS-IIF, POSS-IIN, SRC-J, SERC-EJ, ESO-R, SERC-ER])&gt;
    &lt;CheckboxControl(getcat=[*yes])&gt;
    &lt;CheckboxControl(getfin=[*yes])&gt;
    &lt;CheckboxControl(pixflg=[yes])&gt;
    &lt;CheckboxControl(colbits=[All, *cb_id, *cb_altid, *cb_ra, *cb_sigra, cb_mep, *cb_mura, cb_muprob, *cb_smura, cb_sfitra, *cb_fitpts, cb_err, *cb_flg, *cb_mag, cb_smag, *cb_mflg, *cb_fldid, *cb_sg, cb_xres, cb_pltidx, *cb_xi, *cb_dstctr, *cb_gall])&gt;
    &lt;RadioControl(skey=[*ra, dec, sigra, sigdec, mep, mura, mudec, muprob, smura, smudec, sfitra, sfitdec, fitpts, err, flg, mag, smag, mflg, fldid, sg, xres, yres, pltidx, clr, sigpos, mutot, sigmu, xi, eta, dstctr, gall, galb])&gt;
    &lt;SelectControl(slf=[*hh/dd mm ss, hh/dd:mm:ss, hh.hhh/dd.ddd, ddd.ddd/dd.ddd])&gt;
    &lt;TextControl(minnpts=0)&gt;
    &lt;TextControl(maxnpts=10)&gt;
    &lt;SelectControl(clr=[B1, R1, B2, *R2, I2, B, V, R, J, H, K])&gt;
    &lt;TextControl(bri=0)&gt;
    &lt;TextControl(fai=100)&gt;
    &lt;SelectControl(clr0m1A=[B1, R1, *B2, R2, I2, B, V, R, J, H, K])&gt;
    &lt;SelectControl(clr0m1B=[B1, R1, B2, *R2, I2, B, V, R, J, H, K])&gt;
    &lt;TextControl(bmrmin=-100)&gt;
    &lt;TextControl(bmrmax=100)&gt;
    &lt;TextControl(minposnerr=0.0)&gt;
    &lt;TextControl(maxposnerr=10000.0)&gt;
    &lt;TextControl(mumin=0.0)&gt;
    &lt;TextControl(mumax=10000.0)&gt;
    &lt;TextControl(minmuerr=0.0)&gt;
    &lt;TextControl(maxmuerr=10000.0)&gt;
    &lt;TextControl(minsep=0.0)&gt;
    &lt;HiddenControl(minmagerr=0.0) (readonly)&gt;
    &lt;HiddenControl(maxmagerr=1.0) (readonly)&gt;
    &lt;SelectControl(opstars=[Yes, *No])&gt;
    &lt;SelectControl(whorbl=[Light Stars/Dark Sky, *Dark Stars/Light Sky])&gt;
    &lt;SelectControl(pixgraph=[Progressive JPEG, *JPEG, GIF, PDF, Large JPEG (1 Survey Only), Large GIF (1 Survey Only), PS (1 Survey Only)])&gt;
    &lt;SelectControl(pixfits=[Yes, *No])&gt;
    &lt;SelectControl(ori=[NE - North Up, East Right, *NW - North Up, East Left, SE - North Down, East Right, SW - North Down, East Left, EN - East Up, North Right, ES - East Up, North Left, WN - East Down, North Right, WS - East Down, North Left])&gt;
    &lt;SelectControl(tck=[N and E marks, *Tick Marks, Grid Lines])&gt;
    &lt;SelectControl(starlbl=[Yes, *No])&gt;
    &lt;SelectControl(cmrk=[*None, 5.0 sec Box, 10.0 sec Box, 30.0 sec Box, 1.0 min Box, 2.0 min Box, 5.0 min Box, 10.0 min Box, 5.0 sec Circle, 10.0 sec Circle, 30.0 sec Circle, 1.0 min Circle, 2.0 min Circle, 5.0 min Circle, 10.0 min Circle])&gt;
    &lt;TextControl(aobj=none)&gt;
    &lt;SelectControl(pcl=[*P - Points, L - Points + Labels, C - Connected Points, A - Connected Points + Labels])&gt;
    &lt;TextareaControl(atbl=  )&gt;
    &lt;IgnoreControl(&lt;None&gt;=&lt;None&gt;)&gt;
    &lt;SubmitControl(&lt;None&gt;= Retrieve Data ) (readonly)&gt;
    &lt;SelectControl(gzf=[*Yes, No])&gt;
    &lt;SelectControl(cftype=[*ASCII, XML/VO])&gt;&gt;
  </code></pre>
  
  <p>The one I want to get my hands on is the <code>&lt;SubmitControl(&lt;None&gt;=Retrieve Data ) (readonly)&gt;</code>, which is the third one counted from bottom to top.</p>