Hi Monks,
I was trying to automate an sms function with free sms site "http://www.160by2.com". I am having a problem in submitting a form with java action at the message page
I am posting the code I was trying to achive below.
#!/usr/bin/perl -w
use strict;
use WWW::Mechanize;
my $browser = WWW::Mechanize->new();
$browser->agent('User-Agent=Mozilla/5.0 (Macintosh; U; Intel Mac OS X
+10.5; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5');
my $url ='http://www.160by2.com/Login';
my $result = $browser->get($url);
die "GET failed" unless $result->is_success;
print "Opned the Login Page\n";
$result = $browser->submit_form(
form_number => 1,
fields => {
username => '9400791900',
password => '123456'
}
);
die "SUBMIT FAILED" unless $result->is_success;
print "Passed the Login Page\n";
my $message = $browser->get('http://www.160by2.com/SendSMS?id=3E6145C7
+9AEE54A1FBAE529AE0AA48A6.03');
die "URL Follow failed" unless $message->is_success;
print "sucessfully login inside the Message Page\n";
print "printing the current page fetched \n";
=comment
open ("FILE","> log.txt") or die "cannnot able to open the file for wr
+itting\n";
print FILE $browser->content;
close(FILE);
$message = $browser->submit_form(
form_name => 'frm_sendsms',
fields => {
mobile1 => '9400791900',
msg1 => 'Hello a Test Message from romy',
btnsendsms => 'Send Now'
}
);
=cut
$browser->form_name("frm_sendsms");
$browser->field("mobile1","9400791900");
$browser->field("msg1","Hi Dear I am from lap");
$browser->submit();
die "SUBMIT FAILED" unless $browser->success();
print "Passed the Message Page\n";