|
Hi,
I'm writing a peice of code to log into mailbox using webmail and logoff from there. The problem I face here is I'm able to login but not logoff, On the web page LogOff is an image which when clicked runs a javascript. i get the following error
There is no form numbered 1. at E:\getMails.pl line 25
Can't call method "find_input" on an undefined value at C:/Perl/site/lib/Win32/I
E/Mechanize.pm line 1219.
HTML snippet for LogOff button/image is
a id="lnkLogoff" class="ntbBtn" href="#" onclick='_e(this,this._e_onclick)' _e_onclick="logOff();"
Here is the code so far.
use Win32::IE::Mechanize;
$url = "https://url";
my $ie = Win32::IE::Mechanize->new( visible => 1 );
$ie->form_name( $form_name );
$ie->get( $url );
$ie->submit_form(
form_name => $form_name,
fields => {
username => '',
password => '',
}
);
while($ie->{agent}->Document->readyState !~ /complete/i){ sleep(0.5); }
sleep 2;
$ie->click_button(name => 'Log Off');
-RNK |