我正在使用Python Mechanize创建一个脚本,该脚本可以登录网站并提交表单。但是,此表单有 3 个提交按钮(预览、发布和取消)。我习惯了只有一个按钮...
这是表格:
<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)>>
这是我的代码:
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()
如果我运行这个脚本......它不会工作。没发生什么事。我假设因为它在表单中有 3 个提交按钮?或者是另一个问题?