I am creating a script using Python Mechanize that can login to a website and submit a form. However, this form has 3 submit buttons (Preview, Post, and Cancel). I'm used to only one button...
This is the form:
<TextControl(subject=Is this good for the holidays? Anyone know about the new tech?)>
<IgnoreControl(threads=<None>)>
<TextareaControl(message=Im new to technology stocks.)>
<SelectControl(identity=[*annamae41g])>
<RadioControl(E=[5, 4, *3, 2, 1, 0])>
<SubmitControl(SubmitPreview=Preview Message) (readonly)>
<SubmitControl(SubmitPost=Post Message) (readonly)>
<SubmitControl(SubmitCancel=Cancel) (readonly)>
<HiddenControl(action_btn=) (readonly)>
<HiddenControl(_charset_=) (readonly)>
<HiddenControl(.crumb=4DxnFEwMIGG) (readonly)>
<HiddenControl(r=/Stocks_(A_to_Z)/Stocks_G) (readonly)>
<HiddenControl(bn=25263) (readonly)>
<HiddenControl(<None>=annamae41g) (readonly)>>
And this is my code:
br.open(newtopic_url)
br.select_form(name="postmsg")
br.form['subject'] = "Is this good for the holidays? Anyone know about the new tech?"
br.form['message'] = "Im new to technology stocks."
br.form['E'] = ['3']
br.form['identity'] = ['annamae41g']
print br.form
br.submit()
If I run this script...it won't work. Nothing happens. I am assuming since it has 3 submit buttons in the form? Or is it another issue?