http://qs321.pair.com?node_id=1136204

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

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?