Hi folks,

I'm porting a WWW::Mechanize based program to WWW::Mechanize::Firefox because 
the web site I access is now much more Javascript based and maintenance is 
getting to be a nightmare.

However, I'm struggling on the basics.  Yesterday I started off with a very 
basic program. I wrote this last night and it worked fine, logging into the 
web site.

This morning it no longer works, returning from the get() before the page is 
complete, which then means that the form fields don't exist.  I didn't change 
the script, just shut my laptop down overnight.

Anyone got any ideas?

I've tried setting syncronize => 1 in the new() but as expected that made no 
difference.

If I add a sleep() it works fine.

Also, if I change the get() line to

$mech->get('https://www.xxxxxxxxx.com/', 
':content_file'=>'/home/gary/10.login.html');

I don't even get the first page appear in the tab.

I'm running Fedora 20 with everything installed via RPM except 
WWW::Mechanize::Firefox which had to be installed via CPAN. It did include a 
number of other perl modules as part of the install but I didn't see any 
problems during the install.

#!/usr/bin/perl -w
use strict;
use WWW::Mechanize::Firefox;
    
my $mech = WWW::Mechanize::Firefox->new(
        activate => 1 # bring the tab to the foreground
);
$mech->autoclose_tab( 0 );
print "getting login page\n";
$mech->get('https://www.xxxxxxxx.com/');
print "get complete, got status :",$mech->status(),"\n";
#sleep(5);
$mech->form_name('logonForm');
print "form name=",$mech->current_form->{name},"\n";
$mech->field(userid=>'xxxxxxx');
$mech->field(Pwd=>'xxxxxx');
$mech->submit;


sleep(999);

[gary@gary vista]$ ~/t.pm 
getting login page
get complete, got status :200
No elements found for form name 'logonForm' at /home/gary/t.pm line 13.
[gary@gary vista]$ 


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to