# \[Mechanize\] Invisible button?

**URL:** <https://www.ruby-forum.com/t/mechanize-invisible-button/172708>\
**Category:** Ruby\
**Created:** [July 26, 2009, 12:49pm UTC](https://www.ruby-forum.com/t/mechanize-invisible-button/172708 "2009-07-26T12:49:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaizen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@kaizen](https://www.ruby-forum.com/u/kaizen)\
**Post date:** [July 26, 2009, 12:49pm UTC](https://www.ruby-forum.com/t/mechanize-invisible-button/172708/1 "2009-07-26T12:49:19Z")

</div>

I’m trying to scrap [http://www.ryanair.com/site/ES/](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/](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](http://pastie.org/559295)  
pp trip → [http://pastie.org/559297](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

---

<div class="post-metadata">

**Author:** ![kaizen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@kaizen](https://www.ruby-forum.com/u/kaizen)\
**Post date:** [July 30, 2009, 6:41pm UTC](https://www.ruby-forum.com/t/mechanize-invisible-button/172708/2 "2009-07-30T18:41:02Z")

</div>

AndrÃ©s SuÃ¡rez wrote:

> I’m trying to scrap [http://www.ryanair.com/site/ES/](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/](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](http://pastie.org/559295)  
> pp trip → [http://pastie.org/559297](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.

---

<div class="post-metadata">

**Author:** ![kaizen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@kaizen](https://www.ruby-forum.com/u/kaizen)\
**Post date:** [July 31, 2009, 1:50am UTC](https://www.ruby-forum.com/t/mechanize-invisible-button/172708/3 "2009-07-31T01:50:19Z")

</div>

On Thu, Jul 30, 2009 at 6:41 PM, Julio DÃ­az[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

---

<div class="post-metadata">

**Author:** ![kaizen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@kaizen](https://www.ruby-forum.com/u/kaizen)\
**Post date:** [September 2, 2009, 7:10pm UTC](https://www.ruby-forum.com/t/mechanize-invisible-button/172708/4 "2009-09-02T19:10:56Z")

</div>

Xavier N. wrote:

> On Thu, Jul 30, 2009 at 6:41 PM, Julio DÃ­az[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
