D
David Charles
#simple ebay example
require 'rubygems'
require 'scrubyt'
ebay_data = Scrubyt::Extractor.define do
fetch 'http://www.ebay.com/'
fill_textfield 'satitle', 'ipod'
submit
record "//table[@class='nol']" do
name "//td[@class='details']/div/a"
end
end
puts ebay_data.to_xml
-------
when I run 'ruby ebay_3.rb' I get:
C:\ruby>ruby ebay_3.rb
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navigation/agents/
mechanize.rb:238:in `find_form_based_on_tag': undefined method
`attributes' for
nil:NilClass (NoMethodError)
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/agents/mechanize.rb:236:in `each'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/agents/mechanize.rb:236:in `find_form_based_on_tag'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/agents/mechanize.rb:229:in `lookup_form_for_tag'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/agents/mechanize.rb:181:in `fill_textfield'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/navigation_actions.rb:27:in `fill_textfield'
from ebay_3.rb:9
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/share
d/extractor.rb:75:in `instance_eval'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/share
d/extractor.rb:75:in `initialize'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/share
d/extractor.rb:32:in `new'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/share
d/extractor.rb:32:in `define'
from ebay_3.rb:6
what should I do?
do I have to reinstall the gems scrubyt etc? does ruby need to be
reinstalled? Does this have something to do with windows? should I be
running this on a linux platform instead? (or maybe I should just get a
mac).
require 'rubygems'
require 'scrubyt'
ebay_data = Scrubyt::Extractor.define do
fetch 'http://www.ebay.com/'
fill_textfield 'satitle', 'ipod'
submit
record "//table[@class='nol']" do
name "//td[@class='details']/div/a"
end
end
puts ebay_data.to_xml
-------
when I run 'ruby ebay_3.rb' I get:
C:\ruby>ruby ebay_3.rb
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navigation/agents/
mechanize.rb:238:in `find_form_based_on_tag': undefined method
`attributes' for
nil:NilClass (NoMethodError)
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/agents/mechanize.rb:236:in `each'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/agents/mechanize.rb:236:in `find_form_based_on_tag'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/agents/mechanize.rb:229:in `lookup_form_for_tag'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/agents/mechanize.rb:181:in `fill_textfield'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navig
ation/navigation_actions.rb:27:in `fill_textfield'
from ebay_3.rb:9
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/share
d/extractor.rb:75:in `instance_eval'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/share
d/extractor.rb:75:in `initialize'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/share
d/extractor.rb:32:in `new'
from
c:/ruby/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/share
d/extractor.rb:32:in `define'
from ebay_3.rb:6
what should I do?
do I have to reinstall the gems scrubyt etc? does ruby need to be
reinstalled? Does this have something to do with windows? should I be
running this on a linux platform instead? (or maybe I should just get a
mac).