[Mechanize] Invisible button?

  • Thread starter Andrés Suárez
  • Start date
A

Andrés Suárez

I'm trying to scrap http://www.ryanair.com/site/ES/. I'm looking for the
button "Buscar vuelos". Making a pretty printing of the principal url
and the iframe containing the button:

require 'mechanize'

agent = WWW::Mechanize.new
prices = agent.get 'http://www.ryanair.com/site/ES/' do |homepage|
trip = agent.click(homepage.iframes.first)
tripform = trip.form_with:)name => 'SBform')
pp homepage
pp trip
end

The results are:

pp homepage -> http://pastie.org/559295
pp trip -> http://pastie.org/559297

But it doesn't appear a button with the name "Buscar vuelos". Somebody
can help me?

Thanks in advance,
Andrés Suárez
 
J

Julio Díaz

Andrés Suárez said:
I'm trying to scrap http://www.ryanair.com/site/ES/. I'm looking for the
button "Buscar vuelos". Making a pretty printing of the principal url
and the iframe containing the button:

require 'mechanize'

agent = WWW::Mechanize.new
prices = agent.get 'http://www.ryanair.com/site/ES/' do |homepage|
trip = agent.click(homepage.iframes.first)
tripform = trip.form_with:)name => 'SBform')
pp homepage
pp trip
end

The results are:

pp homepage -> http://pastie.org/559295
pp trip -> http://pastie.org/559297

But it doesn't appear a button with the name "Buscar vuelos". Somebody
can help me?

Thanks in advance,
Andrés Suárez

Maybe this can help you.
The button you are looking for is in a iframe. I don't use mechanize but
I think this is the problem.
I have been playing with the form and firewatir using the iform source
URL and it works.

Good luck.
 
X

Xavier Noria

Maybe this can help you.
The button you are looking for is in a iframe. I don't use mechanize but
I think this is the problem.
I have been playing with the form and firewatir using the iform source
URL and it works.

I did a quick read the other day. In addition the button does not
belong to any form (check it with safari inspector or firebug), and
has a JavaScript handler. Looks like you'll need to emulate JavaScript
or change the library.
 
A

Andrés Suárez

Xavier said:
I did a quick read the other day. In addition the button does not
belong to any form (check it with safari inspector or firebug), and
has a JavaScript handler. Looks like you'll need to emulate JavaScript
or change the library.

Thank both of you for your response. Right, the problem is Mechanize
that doesn't handle javascripts. Now I'm trying with firewatir.

Thanks & regards,
Andrés
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top