# Moving Mechanize to Nokogiri

**URL:** <https://www.ruby-forum.com/t/moving-mechanize-to-nokogiri/160704>\
**Category:** Ruby\
**Created:** [February 19, 2009, 1:05am UTC](https://www.ruby-forum.com/t/moving-mechanize-to-nokogiri/160704 "2009-02-19T01:05:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [February 19, 2009, 1:05am UTC](https://www.ruby-forum.com/t/moving-mechanize-to-nokogiri/160704/1 "2009-02-19T01:05:35Z")

</div>

Hey guys,  
I’m on the second iteration of an app I’m writing to scrape some data  
from iStock and right now, I’m trying to force Mechanize to use  
Nokogiri. I’ve gotten away with not having to for a while, but as I keep  
adding to this app, it’s inevitable.

This is what I thought worked ([http://pastie.org/393471](http://pastie.org/393471)); namely, drop  
the WWW::Mechanize.html\_parser = Nokogiri::HTML inside the constructor.  
But if I do that, it thinks all my Nokogiri functions don’t exist (ie  
it’s still using hpricot).

Any clues?

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [February 19, 2009, 1:45am UTC](https://www.ruby-forum.com/t/moving-mechanize-to-nokogiri/160704/2 "2009-02-19T01:45:00Z")

</div>

You know, I just realized that these error messages probably mean that  
though the parser is Nokogiri, Mechanize pages cannot yet be treated  
like Nokogiri objects.

Here are the bread crumbs I’m following:

- [http://wiki.github.com/tenderlove/mechanize](http://wiki.github.com/tenderlove/mechanize)
- [http://mechanize.rubyforge.org/mechanize/](http://mechanize.rubyforge.org/mechanize/) (down at the bottom but  
apparently the transition from hpricot is not yet implemented, even  
though it says so)

Aaron P. Sat, 01 Nov 2008 10:41:39 PDT

“@PhoeniX: Yes, it will be integrated with WWW::Mechanize. I am working  
on the Hpricot deprecation roadmap now. I hope Nokogiri will be  
integrated with Mechanize by version 1.0 (possibly around January, Iâ€™m  
not sure).”

- [http://tenderlovemaking.com/2008/10/30/nokogiri-is-released/](http://tenderlovemaking.com/2008/10/30/nokogiri-is-released/)

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [February 19, 2009, 1:45am UTC](https://www.ruby-forum.com/t/moving-mechanize-to-nokogiri/160704/3 "2009-02-19T01:45:44Z")

</div>

Regardless, I’m still not sure how to deal with the situation I pastied  
above. Thanks.

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [February 19, 2009, 6:11am UTC](https://www.ruby-forum.com/t/moving-mechanize-to-nokogiri/160704/4 "2009-02-19T06:11:59Z")

</div>

On Feb 18, 2009, at 16:05 , Patrick L. wrote:

> Any clues?

wait
