Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Error Validation

by anbutechie (Sexton)
on Mar 16, 2009 at 09:23 UTC ( [id://750836]=perlquestion: print w/replies, xml ) Need Help??

anbutechie has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
Lets take login page of an application,
On providing Incorrect password and login to the application, following message "Incorrect user name/password" gets displayed in the login page.
Actually the message "Incorrect user name/password" is not defined in client side script (View source of login page).
How to validate the error condition in this case?
Regards,
Anbarasu

Replies are listed 'Best First'.
Re: Error Validation
by Sinistral (Monsignor) on Mar 16, 2009 at 12:49 UTC

    You keep asking the same question again and again (Is it possible to get the application messages What could be the best way to capture controls in a web page?). If you actually provided more information, such as the URL of the login page that you are trying to process, that would help us in helping you.

    As others have said, the process of submitting user name and password is first triggered by the submit button attached to the form of the document. You have to examine the action of the submission form to figure out what happens next. It could be a Perl script, a PHP script, a shell script, an ASP process, or something else I'm not thinking of at the moment. If you don't control the source of the scripts that do the processing, you are limited in what you can do to try to automate the process.

    Most importantly, what does "validate the error condition in this case" mean to you? The simplest way to handle the situation is to use WWW::Mechanize to submit the form information, collect the resulting HTML sent back from the server into a Perl variable, and look for the string "Incorrect user name/password"

Re: Error Validation
by Corion (Patriarch) on Mar 16, 2009 at 09:38 UTC

    Find out how the message gets displayed, and then check for that condition. It would help us to help you better if you told us a bit more about the circumstances and what you're trying to do, but I assume that you're doing Q&A testing of a web application and are trying to automate that.

    To find what data gets sent over the wire, use Wireshark or the mozilla live http headers. Then use your Perl code to make the same requests to retrieve the application status.

Re: Error Validation
by targetsmart (Curate) on Mar 16, 2009 at 09:39 UTC
    Upon submitting the username and password, the data goes to the server(using GET/POST methods).
    The server validates and redirects to home page if authentication success, displays error otherwise.
    source of the login page is updated by the server after submitting, so initial source may not contain 'error message' by default.
    If you need good answers provide more clarity on what you are trying to achieve.

    Vivek
    -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://750836]
Approved by ELISHEVA
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-26 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found