python - Mechanize 提交表单错误: Insufficient items with name '10427'

标签 python forms submit mechanize

我正在尝试使用 Mechanize 提交表单,我尝试了不同的方法,但问题仍然存在。谁可以帮我这个事。预先感谢您!

这是我要提交的表格:http://www.stpairways.st/

这是我正在使用的代码:

def stp_airways(url):
    import re
    import mechanize

    br = mechanize.Browser()
    br.open(url)
    print br.title()
    br.select_form(name = "frmbook")
    br.form['TypeTrajet'] = ["1"]
    br.form['id_depart'] = ["11967"]
    br.form['id_arrivee'] = ["10427"]
    br.form['txtDateAller'] = "5/7/2014"
    br.form['txtDateRetour'] = "12/7/2014"
    br.form['TypePassager1u1000r0b1'] = ["1"]
    br.form['TypePassager2u1000r0b1'] = ["0"]
    br.form['TypePassager3u1000r0b1'] = ["0"]
    br.form['CodeIsoDeviseClient'] = ["17,20,23,24,25,26,27,28,29,30,31,33,34,36,37,64,65,67,68,70,73,80,81,95,96,103,147,151,152,159,160,162,169,170TP1TPF"]
    br.form['CodeIsoDeviseClient'] = ["EUR"]

    # submit
    response1 = br.submit()
    print response1.read()

最佳答案

检查 id 10427 和 119667 之间是否有航类 和 对于表单提交使用

br.submit(name='Place the id of the submit button',label='And its label here')

关于python - Mechanize 提交表单错误: Insufficient items with name '10427' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24093330/

相关文章:

python - 1006 连接异常关闭错误与 python 3.7 websockets

python - 我可以使用基于 fixture 参数 ID 的 pytest.mark.skipif 吗?

php - 从 PHP 访问多个克隆字段

PHP表单文件上传到Mysql并到服务器

python - 删除后 SQLAlchemy 仍然能够从 session 中获取对象

python - 从插槽 PyQt 更改背景颜色

django - 更新表单 - 使用表单集 - 直到运行时才知道初始值

javascript - 提交有关语义 UI 中下拉列表更改的表单?

javascript - 在提交表单的 div 中显示消息

javascript - 在弹出的警报中单击“确定”后更改提交按钮的文本