Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^4: WWW::Mechanize click_button() not working in AIX

by perl_monster (Novice)
on Jul 10, 2012 at 21:31 UTC ( [id://980951]=note: print w/replies, xml ) Need Help??


in reply to Re^3: WWW::Mechanize click_button() not working in AIX
in thread WWW::Mechanize click_button() not working in AIX

The WWW::Mechanize version in both the machines is 1.54 (latest) they were installed on the same day on the Win machine and AIX machine. The Perl version in Win machine is 5.10.1 and AIX version of perl is 5.8.8, I am not sure if that should make any difference. Also, I am thinking if this is problem due to "Https". I am wondering if I need Net::SSLeay.

Replies are listed 'Best First'.
Re^5: WWW::Mechanize click_button() not working in AIX
by onelesd (Pilgrim) on Jul 10, 2012 at 21:45 UTC

    LWP::UserAgent which WWW::Mechanize inherits from takes care of SSL for you.

    Have you tried $mech->find_all_submits( ... criteria ... ) and debugging that to make sure the button is recognized?

      WWW::Mechanize is a subclass of LWP::UserAgent, so this should work:

      $mech->add_handler("request_send", sub { shift->dump; return }); $mech->add_handler("response_done", sub { shift->dump; return });

      After that, do you see the request after you click_button()?

        Ok, so the add_handler call showed a bunch of log messages. Below is the excerpt of the log

        GET https://www.myreports.com/tax_report.php?dc_range=Y&dc_date1=7%2F9 +%2F2012&dc_date2=7%2F9%2F2012 Accept-Encoding: gzip Referer: https://www.myreports.com/admin/ User-Agent: WWW-Mechanize/1.72 Cookie: PHPSESSID=df9f4mmljub54dfi0vvdm2lh12 Cookie2: $Version="1" (no content) HTTP/1.1 200 OK Cache-Control: post-check=0, pre-check=0 Connection: close Date: Wed, 11 Jul 2012 00:00:30 GMT Pragma: no-cache Server: Apache Vary: Accept-Encoding,User-Agent Content-Encoding: gzip Content-Length: 555 Content-Type: text/html; charset=iso-8859-1 Expires: Thu, 19 Nov 1981 08:52:00 GMT Client-Date: Wed, 11 Jul 2012 00:00:31 GMT Client-Peer: xx.xx.xx.xx:xxx Client-Response-Num: 1 Client-SSL-Cert-Issuer: /C=GB/ST=Greater Manchester/L=Salford/O=COMODO + CA Limited/CN=COMODO High-Assurance Secure Server CA Client-SSL-Cert-Subject: /C=US/postalCode=75238/ST=Texas/L=Dallas/stre +et=10300 Sanden Dr Suite 100/O=SpeedFC/OU=PlatinumSSL Wildcard/CN=*.m +yreports.com Client-SSL-Cipher: DHE-RSA-AES256-SHA Client-SSL-Warning: Peer certificate not verified

        The only warning I can see is the last line, looks like the SSL certificate cannot be verified. Not sure if this is causing the issue. In my Win machine, the program works even after the Warning.

      I have used the below which is somewhat similar to what you mentioned

      my $inputobject=$mech->current_form()->find_input( undef,'submit' ); print $inputobject->value . "\n"; $mech->click_button(input => $inputobject); print $mech->status() . "\n";

      The $inputobject shows the correct button element as in the HTML source and the second print returns a status of 200 which apparently stands for OK. All of this still doesn't work, can't even see any errors anywhere. I attempted including LWP::Debug qw(+); in the code, but its not returning me any logging info either

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found