Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: WWW::Mechanize click_button

by amarquis (Curate)
on Jan 23, 2008 at 20:17 UTC ( [id://663876]=note: print w/replies, xml ) Need Help??


in reply to WWW::Mechanize click_button

That's interesting. Does Mechanize support Javascript? I looked through the docs quickly and didn't see anything.

The button element has been around for quite some time, the only reason I could think of for not supporting clicking them is that in practical use their clicks are grabbed by a Javascript event handler and processed that way. I see buttons of type submit fairly rarely.

Specific to your question: I tried to get Mechanize to click using the "click" method, supplying the name of the button, but that didn't work either. Is it possible, in your situation, to cheat and do a substitution of submit buttons to submit inputs?

Edit: L~R's source dive makes sense, the best solution I can think of is still to cheat and sub out the button for an input before Mechanize does the handling. (Oh, and maybe submit a bug against HTML::Form, asking for button type="submit" tags to be handled?)

Replies are listed 'Best First'.
Re^2: WWW::Mechanize click_button
by talexb (Chancellor) on Jan 23, 2008 at 21:04 UTC
      That's interesting. Does Mechanize support Javascript? I looked through the docs quickly and didn't see anything.

    Then you didn't read the WWW::Mechanize::FAQ -- it's probably the most amusing Perl FAQ I've ever read. And apparently people *still* write to Andy asking about JavaScript support. I managed to squirm around that challenge by using Test::WWW:Mechanize on my CGI::Application web application in which I use a few bits of JavaScript -- mostly to pop-up alerts that say "Are you sure?" to confirm various delete operations.

    Seems to work fine.

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

      talexb,
      When I mentioned WWW::Mechanize::Plugin::JavaScript to Andy the other night on #perl (freenode), he was unaware of its existance. Hopefully the module author will continue to work on it because it would make a lot of people happy.

      Cheers - L~R

Re^2: WWW::Mechanize click_button
by Limbic~Region (Chancellor) on Jan 23, 2008 at 20:47 UTC
    amarquis,
    Oh, and maybe submit a bug against HTML::Form, asking for button...

    Actually, I just looked into that too. It seems that bug was filed 2 years ago.

    Cheers - L~R

      Seriously, man, stop bringing in your facts and hard information, it's making my idle speculation look bad!

      :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://663876]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-24 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found