Skip to content

Instantly share code, notes, and snippets.

@clvv
Created October 23, 2011 03:40
Show Gist options
  • Save clvv/1306841 to your computer and use it in GitHub Desktop.
Save clvv/1306841 to your computer and use it in GitHub Desktop.
College Board SAT Score Scraping with Ruby and Mechanize(a quick snippet)
require 'mechanize'
agent = Mechanize.new
agent.get 'https://nsat.collegeboard.org/satweb/satHomeAction.action'
agent.page.forms[2].username = 'username'
agent.page.forms[2].password = 'password'
agent.page.forms[2].submit
# Second login step if required
if agent.page.forms[2]
agent.page.forms[2].password = 'password'
agent.page.forms[2].submit
end
# Get list of scores
scores = agent.page.search '#myScoreBottom .wrapper'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment