Hello, I am trying to create a new gmail account with WWW::Mechanize using the script below, but it is not working, and it keeps loading the sign up page eventhough all the fields are filled correctly. Any suggestion or help would be really appreciated.
#!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; use HTTP::Cookies; use LWP::Simple qw(getstore); #use LWP::Debug qw(+ -conns); ###Field values my $fname = 'john'; my $lname = 'smith'; my $login = 'testc.c.c.testc'; my $password = 'testtestc'; my $question = 'What is your primary frequent flyer number'; my $answer = 'my answer is the best answer'; my $google_captcha = ''; ###Setup WWW::Mechanize my $google = WWW::Mechanize->new(); $google->add_header( 'Accept-Encoding' => 'text/html' ); ###Start print "Fetching captcha image...\n"; $google->get('http://mail.google.com/mail/signup'); my @forms = $google->form_number(0); getstore($google->value("newaccounturl"),'create_google_captcha.jpg'); print "image download (create_google_captcha.jpg)\n\nEnter captcha word: "; $google_captcha = <>; chomp($google_captcha); $google->field("FirstName", $fname); $google->field("LastName", $lname); $google->field("Email", $login); $google->field("Passwd", $password); $google->field("PasswdAgain", $password); $google->field("selection", $question); $google->field("IdentityAnswer", $answer); $google->field("newaccountcaptcha", $google_captcha); $google->untick('PersistentCookie', "yes"); $google->untick('smhck', 1); $google->click_button(name => "submitbutton"); ###Output result open (out,'>page.html'); print out $google->content(); close (out); exit;

In reply to WWW::Mechanize cannot create new gmail account by gontham

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.