Using Ruby with Mechanize to log into a website

匆匆过客 提交于 2019-12-03 17:03:09

This is the approach I usually take. It hasn't failed me:

username_field = form.field_with(:name => "user_session[username]")
username_field.value = "whatever_user"
password_field = form.field_with(:name => "user_session[password]")
password_field.value = "whatever_pwd"
form.submit
harungo

Try without this

login_page = a.click(page.link_with(:text => /Login/))

Or

a.get('http://www.appdata.com/') do |page|
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!