jvermut has asked for the wisdom of the Perl Monks concerning the following question:

jvermut: I am using Win32::IE:: Mechanize jvermut: I want to click an <input type="button"> on a webpage jvermut: The button is not in a form jvermut: So, click_button method doesn't work... jvermut: What to do?? jvermut: Button executes javascript code
  • Comment on Win32::IE:: Mechanize click_button; no form

Replies are listed 'Best First'.
Re: Win32::IE:: Mechanize click_button; no form
by james2vegas (Chaplain) on Aug 14, 2009 at 02:44 UTC
    For the archives:

    The key to solving this was:

    $ie->get('javascript:functionToExecute()');

    which executes the javascript in the context of the current page (basically how bookmarklets work).
Re: Win32::IE:: Mechanize click_button; no form
by AnomalousMonk (Archbishop) on Aug 14, 2009 at 04:44 UTC
    What the...?!?

    Oh, I see!   jvermut: Had several postings in the CB jvermut: Then C&Pd them raw into an SoPW question jvermut: Then unleashed this question on the unsuspecting monks AnomalousMonk: Must go lie down now, too!

Re: Win32::IE:: Mechanize click_button; no form
by Anonymous Monk on Aug 14, 2009 at 10:07 UTC
      The button was unnamed, so it would have to have been getElementsByTagName, but irregardless, calling click or browsing to a javascript: url result in an alert, blocking perl until it is dispatched.