#! /usr/bin/env ruby
require 'mechanize'
require 'nokogiri'
= Mechanize.new
agent = agent.get('https://www.google.co.jp')
page1 = page1.forms[0]
form .q = 'Sports'
form= agent.submit(form)
page2 .links.each do |link|
page2puts "[#{link.text}](#{link.href})"
end