I am using WWW::Mechanize
to automatically add my email address as a preferred one. After a lot of difficulty I could log into the page, but when I try to add an email address as an allowed email address it does not work. Even the link does not show up. What am I doing wrong? The link of the Amazon page is this.
My code:
use WWW::Mechanize;
use HTTP::Cookies;
use HTML::Form;
use WWW::Mechanize::Link;
my $bot = WWW::Mechanize->new();
$bot->agent_alias( 'Linux Mozilla' );
$bot->cookie_jar( HTTP::Cookies->new(file => "cookies.txt",
autosave => 1,
ignore_discard => 1, ) );
# Connect to the login page
my $response = $bot->get( 'https://www.amazon.com/gp/css/homepage.html/' );
# Get the login form. You might need to change the number.
$bot->form_number(3);
# Enter the login credentials.
$bot->field( email => 'email' );
$bot->field( password => 'pass' );
$response = $bot->click();
#print $response->decoded_content;
$bot->get( 'https://www.amazon.com/gp/digital/fiona/manage?ie=UTF8&*Version*=1&*entries*=0#pdocSettings' );
my @links = $bot->find_all_links( tag => "a" );
foreach (@links)
{
print $_->text()."
" ;
}
My tamper data is this
Referer=https://www.amazon.com/gp/digital/fiona/manage?ie=UTF8&%2AVersion%2A=1&%2Aentries%2A=0
POSTDATA=sid=183-7190983-6755358&newEmail=myid%40mailhost.com
Edit: After searching I realised that WWW::Mechanize
may not be able to achieve this as it lacks JavaScript support. I decided to use WWW::Scripter
with the plugin. Would someone please tell me how to do it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…