Created
October 6, 2013 20:41
-
-
Save pwnall/6858837 to your computer and use it in GitHub Desktop.
Mechanizing a Google Form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
loop do | |
agent = Mechanize.new | |
agent.user_agent_alias = 'Mac Safari' | |
puts "Fetching form" | |
page = agent.get "https://docs.google.com/forms/d/15a7OlkEn9qDCxyG23a4ilS6SRa0c61p4el222OFqRAk/viewform" | |
puts "Filling form" | |
form = page.form_with :id => "ss-form" | |
form.field_with(:name => "entry.2077221051").value = "trololol" | |
form.radiobutton_with(:name => "entry.1824489067").check | |
form.radiobutton_with(:name => "entry.2108721354").check | |
puts "Submitting form" | |
page2 = form.submit() | |
puts "Done" | |
puts page2.root | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment