Skip to content

Instantly share code, notes, and snippets.

@ysinc88
Created March 15, 2016 13:03
Show Gist options
  • Save ysinc88/0b98f6babe6abb742480 to your computer and use it in GitHub Desktop.
Save ysinc88/0b98f6babe6abb742480 to your computer and use it in GitHub Desktop.
Mechanize login form - Simple via console
agent = Mechanize.new
agent.get("http://play.google.com/music/publish/")
form = agent.page.forms.first
/*
=> #<Mechanize::Form
{name nil}
{method "POST"}
{action "https://accounts.google.com/AccountLoginInfo"}
{fields
[hidden:0x605897a type: hidden name: Page value: PasswordSeparationSignIn]
[hidden:0x6058cfe type: hidden name: GALX value: rB1_N2NnXUw]
[hidden:0x6059064 type: hidden name: gxf value: AFoagUXZwqpGMEgg6CamLJ6pakafdvVgzQ:1458046304462]
[hidden:0x60593e8 type: hidden name: continue value: https://play.google.com/music/publish/signup]
[hidden:0x6059762 type: hidden name: followup value: https://play.google.com/music/publish/signup]
[hidden:0x6059ae6 type: hidden name: service value: sjap]
[hidden:0x6059e24 type: hidden name: ProfileInformation value: ]
[hidden:0x605bf58 type: hidden name: _utf8 value: ☃]
[hidden:0x605be72 type: hidden name: bgresponse value: js_disabled]
[field:0x605bd82 type: email name: Email value: ]}
{radiobuttons}
{checkboxes}
{file_uploads}
{buttons [submit:0x605bc2e type: submit name: signIn value: Next]}>
*/
emailField = form.fields.last
/*
>> form.fields.last
=> [field:0x605bd82 type: email name: Email value: ]
*/
emailField = "[email protected]" // Email field is not being populated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment