how to add new field to mechanize form (ruby/mechanize)

后端 未结 2 1569
感情败类
感情败类 2021-02-20 10:28

there is a public class method to add field to mechanize form

I tried ..

#login_form.field.new(\'auth_login\',\'Login\')
#login_form.field.new(\'auth_lo         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-20 11:08

    another way how to add new field is to so at the time of posting the form

    page = agent.post( url, {'auth_username'=>'myusername',   #existing field
                             'auth_password'=>'mypassword',   #existing field
                             'auth_login'=>'Login'})   #new field
    

提交回复
热议问题