Python机械化点击多提交表单上的提交

时间:2015-07-10 15:14:51

标签: python mechanize

我必须在多次提交表单上点击第一次提交。提交代码如下:

        <div class="grid ">
            <div class="grid__item grid-u-2-10">
                <label class="form__label">Auto-Fill:</label>
            </div>
            <div class="grid__item grid-u-8-10" id="autofill-button-container">
                <input type="button" id="autofill" name="autofill" value="Auto-Fill" class="form__input" onclick="AutoFill();"  />&nbsp;&nbsp;Use AutoFill first, as it will replace everything below.
            </div>
        </div>

我试过了:

br.open(url+"upload.php")

br.select_form(nr=7)
r = br.submit(label='Auto-Fill')

然而它会返回:

mechanize._form.ControlNotFoundError: no control matching kind 'clickable', label 'Auto-Fill'

请帮助。

1 个答案:

答案 0 :(得分:0)

你正试图点击错误的按钮。输入按钮操作是您需要的。假设你选择了正确的表格。如果不是br.select_form(nr = 8)

尝试:

br.submit(name=autofill)