From: brad smith Date: 2012-11-12T02:27:22+09:00 Subject: Re: problem with the mechanize gem --0015175cae4a3636ba04ce3b7f5a Content-Type: text/plain; charset=ISO-8859-1 Make sure there is actually an anchor tag named News On Nov 11, 2012 11:50 AM, "Lance Ohara" wrote: > Hi. Im new to ruby but think I have grasped the basics. > Right now Im trying to do some screen scraping using the Mechanize gem. > My problem is that my development environment (JetBrains RubyMine > 4.5.4/Ruby 1.9.4/Mechanize 2.5.1) doesnt seem to find the mechanize > methods. > > I try to execute this code: > > require 'rubygems' > require 'mechanize' > agent = Mechanize.new > page = agent.get('http://www.google.com/') > news = page.link_with(:text => 'News').click > > > > And I get this message: > > in `': undefined method `click' for nil:NilClass > (NoMethodError) > from -e:1:in `load' > from -e:1:in `
' > > What could be the problem? > > -- > Posted via http://www.ruby-forum.com/. > > --0015175cae4a3636ba04ce3b7f5a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Make sure there is actually an anchor tag named News

On Nov 11, 2012 11:50 AM, "Lance Ohara"= ; <lists@ruby-forum.com> = wrote:
Hi. Im new to ruby but think I have grasped the basics.
Right now Im trying to do some screen scraping using the Mechanize gem.
My problem is that my development environment (JetBrains RubyMine
4.5.4/Ruby 1.9.4/Mechanize 2.5.1) doesnt seem to find the mechanize
methods.

I try to execute this code:

require 'rubygems'
require 'mechanize'
agent =3D Mechanize.new
page =3D agent.get('http://www.google.com/')
news =3D page.link_with(:text =3D> 'News').click



And I get this message:

in `<top (required)>': undefined method `click' for nil:NilCl= ass
(NoMethodError)
=A0 from -e:1:in `load'
=A0 from -e:1:in `<main>'

What could be the problem?

--
Posted via http://= www.ruby-forum.com/.

--0015175cae4a3636ba04ce3b7f5a--