for control in form.controls:
if control.type == 'text':
if 'user' in control.name:
control.value = 'blah'
if 'mail' in control.name:
control.value = 'blah'
if control.type == 'password':
if 'pass' in control.name:
control.value = 'blah'
if control.type == 'checkbox':
if 'agree' in control.name:
control.selected = True
if control.type == 'submit':
if 'Submit' in control.name:
control.readonly = False
I fill the form out this way. Then I go to selected the "Agree" checkbox, after doing that I try to use br.submit() to submit the form and send the data. The error I get it:
AttributeError: SubmitControl instance has no attribute 'click'
This is the HTML source of the submit and agree controls:
<input type="submit" name="regSubmit" value="Register" />
<label for="regagree"><input type="checkbox" name="regagree" onclick="checkAgree();" id="regagree" class="check" /> <b>I Agree</b></label>
The HTML source of this particular website has this JavaScript:
function verifyAgree()
{
if (document.forms.creator.passwrd1.value != document.forms.creator.passwrd2.value)
{
alert("The two passwords you entered are not the same!");
return false;
}
if (!document.forms.creator.regagree.checked)
{
alert("Please read and accept the agreement before registering.");
return false;
}
return true;
}
function checkAgree()
{
document.forms.creator.regSubmit.disabled = isEmptyText(document.forms.creator.user) || isEmptyText(document.forms.creator.email) || isEmptyText(document.forms.creator.passwrd1) || !document.forms.creator.regagree.checked;
setTimeout("checkAgree();", 1000);
}
setTimeout("checkAgree();", 1000);
When I type print forms into IDLE, the form is returned as filled and all the proper controls are selected. I can't for the life of me figure out WHY this isn't working. I've been at it for two days.
Help is greatly appreciated.