title: Use ruby mechanize to login into Dreamhost
body: <pre><code>require 'rubygems'
  require 'mechanize'
  
  agent = Mechanize.new
  
  page = agent.get('https://panel.dreamhost.com')
  
  pp login_form
  </code></pre>
  
  <p>results in:</p>
  
  <pre><code>#&lt;Mechanize::Form
   {name nil}
   {method "POST"}
   {action "https://panel.dreamhost.com/index.cgi"}
   {fields
    [text:0x3fe74cd329bc type: text name: username value: ]
    [field:0x3fe74cd32868 type: password name: password value: ]
    [hidden:0x3fe74cd32714 type: hidden name: Nscmd value: Nlogin]}
   {radiobuttons}
   {checkboxes}
   {file_uploads}
   {buttons [button:0x3fe74cd2f744 type: submit name:  value: ]}&gt;
  </code></pre>
  
  <p>--</p>
  
  <pre><code># Fill out and submit login form
  login_form = page.form()
  
  login_form.username = 'xxx'
  login_form.password = 'xxx'
  
  login_form.method = 'POST'
  login_form.action = 'https://panel.dreamhost.com/index.cgi
  
  page = agent.submit(login_form, login_form.buttons.first)
  </code></pre>
  
  <p>The resulting page is the same as the original page so I am obviously doing something wrong. Any help would be much appreciated.</p>