here is code that I have:
agent = Mechanize.new
page = agent.get 'http://google.com'
page.save 'google_index.htm'
How can I restore that google_index.htm to Mechanize::Page object and continue working with that page, eg. submit, parse, etc?
I’ve tried to do YAML::dump() or Marshal::dump(), but it seems to be impossible:
irb(main):024:0> page.class
=> Mechanize::Page
then:
irb(main):013:0> YAML::dump(page)
TypeError: can't dump anonymous class Class
and:
irb(main):023:0> Marshal::dump(page)
TypeError: no marshal_dump is defined for class Nokogiri::XML::Element
Maybe you could just restore the cookies:
There’s a good chance that your session will be expired though.