Hi guys,

I am using WWW::Mechanize to automate a script on the amazon page. However i am not even able to sign into the page using WWW::Mechanize. The url link. is where the form is. How would i use mechanize to log into this page.

My code:
use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get("https://www.amazon.com/gp/css/homepage.html/"); $mech->submit_form( form_name => 'yaSignIn', fields => { 'email' => $email, 'password' => $password, }, ); print $mech->content();
The output of mech dump is as follows.
POST https://www.amazon.com/gp/flex/sign-in/select.html [yaSignIn] useRedirectOnSuccess=1 (hidden readonly) path=/gp/css/homepage.html (hidden readonly) action=sign-in (hidden readonly) protocol=https (hidden readonly) email= (text) password= (password) <NONAME>=Sign In (submit)
The html for sumbitting a form
<input width="201" type="image" height="22" border="0" align="absmiddl +e" id="submit" value="Continue" alt="sign in using our secure server" + src="https://images-na.ssl-images-amazon.com/images/G/01/x-locale/co +mmon/buttons/sign-in-secure._V192194766_.gif">
When i save the output to file it says please enable cookies to continue.

In reply to Using www::Mechanize by ItsyBitsy

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.