?
Solved

validat eurl

Posted on 2005-02-24
19
Medium Priority
?
363 Views
Last Modified: 2012-06-27
i have to validate login process of my website.
here is what i have to :
1: request connection to this URL from the browser:
https://xxxxxxxxxxxxxxxxxxxxxx

2: verify that browser has connected to this URL (a redirect):
https://yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

3: input login aaaaaaaaaaaaaaaaaaaa and password ************* and
   activate "Log In" button

4: verify that browser has connected to this URL:
https://zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

5: input e-mail address ***************************** and activate
   "Continue" button

6: verify that browser has connected to this URL:
https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


any suggestion how to do this thru perl script. do i have to maintain cookies in the script.
0
Comment
Question by:shahrahulb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 6
  • 2
  • +1
19 Comments
 
LVL 16

Expert Comment

by:manav_mathur
ID: 13393140
Is this a web-site testing script??

Manav
0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13393150
Yes.
0
 
LVL 16

Expert Comment

by:manav_mathur
ID: 13393190
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Expert Comment

by:gripe
ID: 13394384
WWW::Automate hasn't been updated in 3 years and is no longer maintained.

I would suggest a more common (and widely used) module like 'WWW::Mechanize' which is full of features, very well written and currently maintained. Andy Lester has also written a Mech subclass specifically geared for Web testing called 'Test::WWW::Mechanize' specifically geared for testing purposes. Both module's are available in Andy's PAUSE directory (http://search.cpan.org/~petdance/)  or specifically at:

http://search.cpan.org/~petdance/Test-WWW-Mechanize-1.02/
http://search.cpan.org/~petdance/WWW-Mechanize-1.11_02/

I also noticed that your test plan contains a redirect. You should be aware that javascript redirects will not be parsed properly by these modules and that you'll have to parse out and respond to the javascript manually. (If you're indeed using a javascript redirect rather than an actual HTTP redirect.)

Hope that helps.
0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13394656
but, can i do post and get request using Test-WWW-Mechanize-1.02
because at certain stage i have enter login information
Rahul
0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13394952
i m trying to install WWW-Mechanize
i m getting the error:

summer>>perl Makefile.PL PREFIX=/u/rshah1/tools-www

Part of WWW::Mechanize's test suite is run live tests against Google.
Since it looks like you're connected to the Internet, these test will
be enabled.  If you want to disable these tests, re-run Makefile.PL with
the --skiplive switch.

Do you want to install the mech-dump utility? [y] n  

WWW::Mechanize likes to have a lot of test modules for some of its tests.
The following are modules that would be nice to have, but not required.

        Test::Pod
        Test::Memory::Cycle
        Test::Warn


Warning: prerequisite HTML::Form failed to load: Can't locate HTML/Form.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl .) at (eval 23) line 3, <STDIN> line 1.
Warning: prerequisite HTML::TokeParser 2.28 not found at /usr/local/lib/perl5/5.6.1/ExtUtils/MakeMaker.pm line 343, <STDIN> line 1.
Warning: prerequisite HTTP::Request 1.3 not found at /usr/local/lib/perl5/5.6.1/ExtUtils/MakeMaker.pm line 343.
Warning: prerequisite LWP 5.76 not found at /usr/local/lib/perl5/5.6.1/ExtUtils/MakeMaker.pm line 343.
Warning: prerequisite LWP::UserAgent 2.024 not found at /usr/local/lib/perl5/5.6.1/ExtUtils/MakeMaker.pm line 343.
Warning: prerequisite Test::More failed to load: Can't locate Test/More.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl .) at (eval 31) line 3.
Warning: prerequisite URI 1.25 not found at /usr/local/lib/perl5/5.6.1/ExtUtils/MakeMaker.pm line 343.
Writing Makefile for WWW::Mechanize
0
 
LVL 18

Expert Comment

by:kandura
ID: 13395174
The prefered way of installing perl modules is by using the CPAN module. That will take care of missing dependencies, for one thing, and that is what you're suffering from now.
Typically a decent Perl installation comes with the "cpan" utility. This makes installing new modules as simple as typing:

    cpan WWW::Mechanize

If cpan isn't available, then try this:

    perl -MCPAN -e shell
and type
    install WWW::Mechanize
0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13395204
i think so i have installed the module.
i
my perl script contains:
use strict;
use lib '/u/rshah1/toolswww/lib/site_perl/5.6.1/';
use HTTP::Cookies;
use HTTP::Request::Common;
use LWP::UserAgent;
use Sys::Hostname;
use Time::Local;
use Crypt::SSLeay;
use WWW::Mechanize;


i get error
HTTP::Request version 1.3 required--this is only version 1.24 at /u/rshah1/toolswww/lib/site_perl/5.6.1//WWW/Mechanize.pm line 98.
BEGIN failed--compilation aborted at /u/rshah1/toolswww/lib/site_perl/5.6.1//WWW/Mechanize.pm line 98.
Compilation failed in require at ./del.pl line 11.
BEGIN failed--compilation aborted at ./del.pl line 11.

and line 11 contains the "use WWW::Mechanize"
0
 
LVL 18

Expert Comment

by:kandura
ID: 13395277
what do you suppose "HTTP::Request version 1.3 required--this is only version 1.24" means? It means you have to upgrade that module...

   cpan HTTP::Request
0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13395445
i have installed the module properly.
script:
#!/usr/local/bin/perl
use strict;
use lib '/u/rshah1/toolswww/lib/site_perl/5.6.1/';
use lib '/u/rshah1/mechanize/lib/site_perl/5.6.1';
use HTTP::Cookies;
use HTTP::Request::Common;
use LWP::UserAgent;
use Sys::Hostname;
use Time::Local;
use Crypt::SSLeay;
use WWW::Mechanize;

my $mech = WWW::Mechanize->new();
my $url = 'https://zzzzz';
$mech->get( $url )


when i run the script i get error:
Not a GLOB reference at /usr/local/lib/perl5/site_perl/5.005/HTML/TokeParser.pm line 43.
0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13395536
this is painful. i reinstalled the HTML::TokenParser
now i m getting error:

Can't locate HTML/Tagset.pm in @INC (@INC contains: /u/rshah1/CPAN/lib/site_perl/5.6.1/sun4-solaris /u/rshah1/CPAN/lib/site_perl/5.6.1 /u/rshah1/mechanize/lib/site_perl/5.6.1/sun4-solaris /u/rshah1/mechanize/lib/site_perl/5.6.1 /u/rshah1/toolswww/lib/site_perl/5.6.1//sun4-solaris /u/rshah1/toolswww/lib/site_perl/5.6.1/ /usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl .) at /u/rshah1/CPAN/lib/site_perl/5.6.1/sun4-solaris/HTML/TokeParser.pm line 12.
BEGIN failed--compilation aborted at /u/rshah1/CPAN/lib/site_perl/5.6.1/sun4-solaris/HTML/TokeParser.pm line 12.
Compilation failed in require at /u/rshah1/CPAN/lib/site_perl/5.6.1/WWW/Mechanize.pm line 101.
BEGIN failed--compilation aborted at /u/rshah1/CPAN/lib/site_perl/5.6.1/WWW/Mechanize.pm line 101.
Compilation failed in require at ./del1.pl line 13.
BEGIN failed--compilation aborted at ./del1.pl line 13.



can someone explain me how to install WWW::Mechanize from scratch so that i can run simple script that i given above
0
 
LVL 18

Expert Comment

by:kandura
ID: 13395580
   perl -MCPAN -e shell

    force install WWW::Mechanize
0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13395599
but where the module will be exactly installed. what path should i use from my script.
i mean use lib 'blah blah.......'

so that i can run simple script:
my $mech = WWW::Mechanize->new();
my $url = 'https://zzzzz';
$mech->get( $url )

also, after installing module, can i do the 5 steps i asked in my orignal question. top most part of this page
0
 
LVL 18

Accepted Solution

by:
kandura earned 1500 total points
ID: 13395781
they will be installed wherever perl can find them on its own. You don't need any 'use lib' statements.
0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13395828
u didn't answer my other question
also, after installing module, can i do the 5 steps i asked in my orignal question. top most part of this page
0
 
LVL 18

Expert Comment

by:kandura
ID: 13396378
gripe's comment should be sufficient. Your responsibility is to read the documentation of Test::WWW::Mechanize and WWW::Mechanize first. You'll find it is very simple to do what you want.
I never intended to completely answer your main question when I commented about how to install modules, but here's a start:

use Test::WWW::Mechanize;

$mech = new Test::WWW::Mechanize;

$mech->get( 'https://xxxx' );

die "Didn't follow redirect: " . $mech->uri unless $mech->uri eq 'https://yyyy';

$mech->submit_form(
        form_number => 0,
        fields      => {
            username    => 'mungo',
            password    => 'lost-and-alone',
        }
    );
 

etcetera.
0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13396404
i have installed. WWW::Mechanize
can i do
use Test::WWW::Mechanize;

0
 
LVL 1

Author Comment

by:shahrahulb
ID: 13396409
i m creating a new question for this
0
 
LVL 18

Expert Comment

by:kandura
ID: 13396482
Test::WWW::Mechanize adds a couple of handy testing methods to the original WWW:::Mechanize, so you can do without it. The snippet I showed you doesn't actually use any Test:: specific things.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question