Python mechanize - two buttons of type 'submit'

前端 未结 4 1463
刺人心
刺人心 2021-02-02 09:42

I have a mechanize script written in python that fills out a web form and is supposed to click on the \'create\' button. But there\'s a problem, the form has two buttons. One fo

4条回答
  •  离开以前
    2021-02-02 10:04

    Use the 'click' method. E.g.

    mybrowser.select_form(nr=0)
    req = mybrowser.click(type="submit", nr=1)
    mybrowser.open(req)
    

    Should work.

提交回复
热议问题