I think I've reached the end of my quest here. This is not the usual 'freeze after click' problem searching keeps finding for me.

I'm working on scripting automated interfaces to HP iLO logins using WWW::Mechanize::Firefox. For the most part, things are falling into place as expected. Navigating login, getting to information tabs, pulling information out of the html. But I'm having one unexplainable problem with the logout button. I have different versions of iLO to interface with - 2, 3 and 4. The web layout and design for 3 and 4 are very similar. They both have the same page layout, included javascript, and design. The logout button design in particular is identical for both, except for one small detail. Version 3 uses an onclick event, while Version 3 uses an onmouseup event

(version 3) <a id="home_link" rel="localize[masthd.home]" onclick="iLO.openLink("s +ummary.html");this.blur();return false;" href="summary.html">Home</a> | <button id="logout_button" rel="localize[masthd.signout]" onclick="iLO +.doLogout();">Sign Out</button>
(version 4) <a id="home_link" rel="localize[masthd.home]" onclick="iLO.openLink("s +ummary.html");this.blur();return false;" href="summary.html">Home</a> | <button id="logout_button" rel="localize[masthd.signout]" onmouseup="i +LO.doLogout();">Sign Out</button>

For iLO version 3 I can activate the logout button as expected with:

$mech->click_button(id => 'logout_button');

But that same action on iLO version 4 does nothing. Seems nothing I do will activate the button. I've tried $mech->click with the appropriate xpath keys, I've tried using $mech->by_id to get the node, followed by $node->click. I've also tried $mech->follow_link( tag => 'button', id => 'logout_button' );

If I try $mech->eval('iLO.doLogout();'), I get:

(in cleanup) MozRepl::RemoteObject: ReferenceError: iLO is not defined + at ...

I can find and retrieve the logout button node and manipulate it without errors, but it just doesn't do anything. I guess I should expect that being that it has no onclick handler. If I check the page for $mech->clickables, it clearly shows both 'Home' and 'Sign Out' for version 3, but only 'Home' for version 4.

What can I do to trigger this event? Is there any way to send an onmouseup event with WWW::Mechanize::Firefox? Maybe some hoops I can jump through to execute the javascript doLogout() function directly?


In reply to WWW::Mechanize::Firefox button click problem HP iLO by ruzam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.