Use ruby gem “mechanize” as httpclient

Need to require ‘mechanize’

Simple login example:
method 1:


    login_form = @agent.get("#{DD_DEV_ADMIN_LOGIN_URL}").forms[0]
    user_email_input = login_form.field_with(:name => 'admin_user[email]')
    user_password_input = login_form.field_with(:name => 'admin_user[password]')
    user_email_input.value = USERNAME
    user_password_input.value = PASSWORD
    @agent.submit(login_form, login_form.buttons.first)

method 2:

Leave a comment