Hi all,
I’ve just downloaded the development release of Ruby 1.9.0.
Unfortunately, url.relative? isn’t working well for me.
Any tips or tricks to get Mechanize to work properly would be grand,
thanks.
irb output:
$ irb
irb(main):001:0> require ‘rubygems’
=> true
irb(main):002:0> require ‘mechanize’
=> true
irb(main):003:0> agent = WWW::Mechanize.new
=> #<WWW::Mechanize:0x4076e220
@cookie_jar=#<WWW::Mechanize::CookieJar:0x4076e20c @jar={}>, @log=nil,
@open_timeout=nil, @read_timeout=nil, @user_agent=“WWW-Mechanize/0.7.0
(http://rubyforge.org/projects/mechanize/)”, @watch_for_set=nil,
@ca_file=nil, @verify_callback=nil, @cert=nil, @key=nil, @pass=nil,
@redirect_ok=true, @history=[],
@pluggable_parser=#<WWW::Mechanize::PluggableParser:0x4076e1a8
@parsers={“text/html”=>WWW::Mechanize::Page},
@default=WWW::Mechanize::File>, @user=nil, @password=nil, @digest=nil,
@auth_hash={}, @digest_response=nil, @proxy_addr=nil, @proxy_pass=nil,
@proxy_port=nil, @proxy_user=nil, @conditional_requests=true,
@follow_meta_refresh=false, @connection_cache={}, @keep_alive_time=300,
@keep_alive=true>
irb(main):004:0> page = agent.get(‘http://google.com/’)
RuntimeError: no history. please specify an absolute URL
from
/home/kylehunter/gems/gems/mechanize-0.7.0/lib/www/mechanize.rb:397:in
raise' from /home/kylehunter/gems/gems/mechanize-0.7.0/lib/www/mechanize.rb:397:in
to_absolute_uri’
from
/home/kylehunter/gems/gems/mechanize-0.7.0/lib/www/mechanize.rb:164:in
get' from (irb):4 from /home/kylehunter/ruby19/lib/ruby/1.9.0/irb.rb:150:in
block (2
levels) in eval_input’
from /home/kylehunter/ruby19/lib/ruby/1.9.0/irb.rb:259:in
signal_status' from /home/kylehunter/ruby19/lib/ruby/1.9.0/irb.rb:147:in
block in
eval_input’
from /home/kylehunter/ruby19/lib/ruby/1.9.0/irb.rb:146:in eval_input' from /home/kylehunter/ruby19/lib/ruby/1.9.0/irb.rb:70:in
block in
start’
from /home/kylehunter/ruby19/lib/ruby/1.9.0/irb.rb:69:in catch' from /home/kylehunter/ruby19/lib/ruby/1.9.0/irb.rb:69:in
start’
from /home/kylehunter/ruby19/bin/irb:13:in `’
irb(main):005:0>