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";

In reply to How to automate a form with javascript by romy_mathew

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.