· 1 min read
Screencast: Mechanize
Download (22.8 MB, 10:16) Alternativer Download für iPod & Apple TV (14.8 MB, 10:16)
Resourcen:
Quellcode: [bash] sudo gem install mechanize [/bash]
[ruby] # script/console puts Readline::HISTORY.entries.split(“exit”).last[0..-2].join(“n”)
# lib/tasks/product_prices.rake desc “Import wish list” task :import_list => :environment do require ‘mechanize’ agent = WWW::Mechanize.new agent.get(“http://railscasts.tadalist.com/session/new”) form = agent.page.forms.first form.password = “secret” form.submit agent.page.link_with(:text => “Wish List”).click agent.page.search(“.edit_item”).each do |item| Product.create!(:name => item.text.strip) end end [/ruby]