Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

perl form filling

by PerlSufi (Friar)
on Apr 17, 2013 at 20:26 UTC ( #1029219=perlquestion: print w/replies, xml ) Need Help??
PerlSufi has asked for the wisdom of the Perl Monks concerning the following question:

hello monks I am having an issue filling out a form with valid information. Here is my code:
#! /usr/bin/perl use Web::Scraper; use WWW::Mechanize; use WWW::Mechanize::FormFiller; use LWP::UserAgent; #This block of code follows from the CAPS homepage to the Account Inqu +iries link my $mech = WWW::Mechanize->new(); my $url = ""; $mech->get($url); $mech->follow_link( url => ' +.asp'); if ($mech->success()){ print "Successful Connection\n"; } else { print "Not a successful connection\n"; } #enter start and end date print "Enter Start date in the form of MMDDYY:\n"; my $start_date = <STDIN>; chomp; print "Please Enter an end date in the form of MMDDYY:\n"; my $end_date = <STDIN>; chomp; #This block of code is intended to fill in the required forms $mech->get(""); my $usr = "11111"; #not valid id for security purposes my $pw = "1111"; #not valid pw for security $mech->form_number(1); $mech->field( "capsn", $usr); $mech->form_number(2); $mech->field("capsp", $pw); $mech->form_number(3); $mech->field( "startdate", $start_date); $mech->form_number(4); $mech->field( "enddate", $end_date); $mech->click(); #print the content (for debugging) print $mech->content;
The message I get with the displayed content is that I did not enter a valid starting date, but I have. Any help is greatly appreciated! Love, PerlSufi

Replies are listed 'Best First'.
Re: perl form filling
by CountOrlok (Friar) on Apr 17, 2013 at 20:40 UTC
    The two chomp lines you have there, replace them with:
    chomp($start_date); chomp($end_date);
      Yes! I love you! My n00bness didn't allow me to see that PerlSufi

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1029219]
Approved by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2017-06-24 14:35 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (558 votes). Check out past polls.