I am working on a project which requires a login using Mechanize in python.
It is having trouble accessing the login in the form by its name. I am not too familiar with HTML, but it appears to have something to do with the label that is referencing the login entry field.
For those who are not familiar with Mechanize, you can pretty much ignore that. Just know that br.form['xzy'] = '123'
sets the field with a name of 'xyz' to '123' in whatever current form is selected. So in short the problem is finding either the correct name for the username entry field or a workaround.
This is what the python mechanize code looks like...
br.select_form(nr=0)
br.form['username'] = 'dave'
br.form['password'] = 'cats123'
session = br.submit()
This is what the input looks like in the HTML of the page I'm working on...
<label for="username" class="fl-label"><span class="accesskey">A</span>ccount:</label>
<input id="username" name="username" class="required" tabindex="1" accesskey="n" type="text" value="" size="32" autocomplete="false"/>
And here is the error I am running into...
File "vcl.py", line 12, in maristLogin
br.form['username'] = 'steh'
mechanize._form.ControlNotFoundError: no control matching name 'username'