Skip to content

Instantly share code, notes, and snippets.

@ardian
Last active August 29, 2015 14:08
Show Gist options
  • Save ardian/d862a2bdda7446b43941 to your computer and use it in GitHub Desktop.
Save ardian/d862a2bdda7446b43941 to your computer and use it in GitHub Desktop.
require 'mechanize'
mechanize = Mechanize.new
page = mechanize.get('https://www.google.com/')
form = page.forms.first
form['q'] = 'taekwondo'
page = form.submit
page.search('body').each do |h3|
puts h3.text.strip
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment