Skip to content

Instantly share code, notes, and snippets.

@ileacristian
Created May 22, 2011 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ileacristian/985293 to your computer and use it in GitHub Desktop.
Save ileacristian/985293 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'mechanize'
require 'nokogiri'
file = File.open( File.join('','Users','Ilea Cristian','Desktop','test.html'), 'w')
agent = Mechanize.new
agent.user_agent_alias = 'Mac Safari'
agent.follow_meta_refresh = true
home_page = agent.get('http://bitcell.info/')
login_page = agent.click( home_page.link_with(:text => 'Login'))
login_form = login_page.forms[1]
login_form.username = 'enum'
login_form.password = 'password-to-be-set'
logged_in_page = agent.submit(login_form, login_form.buttons.first)
file.puts logged_in_page.search("//div[@class='forumbg']")
file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment