[Mechanize] Invisible button?

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

Andrés Suárez wrote:

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.

On Thu, Jul 30, 2009 at 6:41 PM, Julio Díaz[email protected] wrote:

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.

Xavier N. wrote:

On Thu, Jul 30, 2009 at 6:41 PM, Julio Díaz[email protected] wrote:

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.

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