Howdy folks.  I find myself on a project where I want to use a
browser-based test tool to record client-side performance metrics. 
After playing with several such tools again, Watir again emerged as the
tool that I was first able to get a working script with.

But along the way, I noticed with some amazement that Perl's
Win32::IE::Mechanize module was able to handle the basic HTTP
authentication that gives so many people headaches with other tools.  It
doesn't do it by automating the dialog asking for the login
information, but rather it prevents the dialog from appearing by
submitting the credentials right from the beginning.  That means it
makes one fewer transaction with the web server (avoiding the first
request that gets a 401 response), but perhaps I can live with that.

Has anyone else tried to implement this with Watir?  If not I may try it
myself.  Here's the core of it in IE::Mechanize where it formulates the
Authorization header, really simple stuff:

sub __authorization_basic {
    my( $user, $pass ) = @_;
    defined $user && defined $pass or return;

    require MIME::Base64;
    return "Authorization: Basic " .
           MIME::Base64::encode_base64( "$user:$pass" ) .
           "\015\012";
}
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to