Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble logging in with Ruby's Mechanize
    primarykey
    data
    text
    <p>Trying to create an automatic login to a webpage which takes HTTP POST input but failing to do so.</p> <p>Here's the webpage: <a href="https://job.jobnet.dk/CV/Login/Login.aspx" rel="nofollow">https://job.jobnet.dk/CV/Login/Login.aspx</a></p> <p>I created a user <strong>stacktest</strong> with password <strong>abcdefghijklmn1</strong> if you want to try your hand at it.</p> <p>Here's the not-working code:</p> <pre><code>require 'rubygems' require 'mechanize' agent = Mechanize.new page = agent.get 'https://job.jobnet.dk/CV/Login/Login.aspx' login_form = page.form_with(:action =&gt; 'Login.aspx') login_form['ctl00$ctl00$JobnetBaseMiddelContent$LoginContentPlaceHolder$txtUsername'] = 'stacktest' login_form['ctl00$ctl00$JobnetBaseMiddelContent$LoginContentPlaceHolder$txtPassword'] = 'abcdefghijklmn1' page = agent.submit login_form p page # should be a new page but isn't a new page </code></pre> <p>Needless to say it does not work :) </p> <p>There is also a hidden input field called <strong>__VIEWSTATE</strong> which has the value of</p> <pre><code>/wEPDwUJOTczNzQwMzk1D2QWAmYPZBYCZg9kFgoCAQ8WAh4EVGV4dAVlPGEgY2xhc3M9Im1lbnUgbG9nb3V0bGluayIgaHJlZj0iL0NWL0xvZ2luL0xvZ2luLmFzcHgiIHRpdGxlPSJMb2cgaW5kIiBpZD0idG9wTGlua3NMb2dpbiI+TG9nIGluZDwvYT5kAgIPFgIfAGVkAgMPZBYEAgEPZBYCAgEPFgIfAAUSbG9nIGluZCBww6Ugam9ibmV0ZAIFD2QWAgIBD2QWCgIPDxYEHgVjbGFzcwVFbG9naW5mdWxsbGluZV9sZWZ0YWxpZ25fbGVmdHBhZCBsb2dpbnNwYWNlYWZ0ZXIgZXJyb3JDb250YWluZXJFbGVtZW50HgdWaXNpYmxlaGQCFQ9kFgICAQ8PFgIeC05hdmlnYXRlVXJsBQ4vQ1YvbG9naW4uYXNoeGRkAhcPFgIeBGhyZWYFIC9DVi9Mb2dpbi9Gb3Jnb3R0ZW5QYXNzd29yZC5hc3B4ZAIZD2QWBAIDD2QWAgIBDxYCHwQFHy9DVi9Mb2dpbi9OZXdVc2VySm9iU2Vla2VyLmFzcHhkAgUPZBYCAgEPDxYCHwMFDi9DVi9sb2dpbi5hc2h4ZGQCGw9kFgQCAQ9kFgICAQ8WAh8EBR8vQ1YvTG9naW4vTmV3VXNlckpvYlNlZWtlci5hc3B4ZAIDD2QWAgIBDw8WAh8DBQ4vQ1YvbG9naW4uYXNoeGRkAgQPFgIfAAX7Ajx1bD48bGk+PGEgaHJlZj0iaHR0cHM6Ly9pbmZvLmpvYm5ldC5kay92aWEyMDUuaHRtbCI+b20gam9ibmV0PC9hPjwvbGk+PGxpPjxhIGhyZWY9Imh0dHBzOi8vaW5mby5qb2JuZXQuZGsvdmlhMTE1Lmh0bWwiPmdvZGUgcsOlZCB0aWwgam9ic8O4Z25pbmc8L2E+PC9saT48bGk+PGEgaHJlZj0iaHR0cHM6Ly9pbmZvLmpvYm5ldC5kay92aWEyLmh0bWwiPmJsYW5rZXR0ZXI8L2E+PC9saT48bGk+PGEgaHJlZj0iaHR0cHM6Ly9pbmZvLmpvYm5ldC5kay92aWEyMDYuaHRtbCI+cG9saXRpayBvbSBwZXJzb25kYXRhPC9hPjwvbGk+PGxpPjxhIGhyZWY9Imh0dHBzOi8vaW5mby5qb2JuZXQuZGsvdmlhMjA3Lmh0bWwiPmpvYm5ldCBpbiBlbmdsaXNoPC9hPjwvbGk+PC91bD5kAgUPFgIfAmdkZGZTKNqgl0MJ9Ss0FPqJ0tr8E74T </code></pre> <p>Cheers</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload