Friends,
I am using WWW::Mechanize to automate some form entry work. I want to use the <title> of the web pages I visit to ensure the correct pages are being loaded and submitted to. Here's is my code ...
...
my $mech = WWW::Mechanize->new();
my $resp = $mech->get( $upLoadUrl );
if ( !$mech->success ) {
print "Error could not access $upLoadUrl\n";
exit 1;
}
my $title = $mech->title();
#print Dumper( $resp );
if ( $title ne $upLoadTitle ) {
print "$upLoadUrl is not titled [$upLoadTitle]\n";
exit 1;
}
$resp = $mech->submit_form (
fields => {
j_username => $user,
j_password => $password,
}
);
$title = $mech->title(); # get the new title?
print "$upLoadUrl is titled [$upLoadTitle]\n";
print "resp = [ " . Dumper( $resp ) . "]\n";
...
... and here is the output I get ...
./httpsUpload.pl[224] https://localhost:8080/SecureUpLoad is titled [S
+ecure HTTP File Uploader (SHFU) Logon]
resp = [ $VAR1 = bless( {
'_protocol' => 'HTTP/1.1',
'_content' => '
<HTML>
<HEAD><TITLE>Props update example jsp</TITLE></HEAD>
...
Why didn't my second callto $mech->title() return
Props update example jsp ??? What should I be doing to get this second title?
| Plankton: 1% Evil, 99% Hot Gas. |
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.