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

Hi All, I am trying to automate the authentication of a secured portal for my automation project.I have tried number of ways of doing the same but still struggling with the same. If we do the same with LWP or machanize it is achieved but the content I am getting back in response is the not same as we get in IEautomation content method which is actual HTML content of web page. Can anybody provide me with the solution if they have encountered the same situation earliar. I would prefer if somebody come up with a solution achieved through Win32::IEAutomation package.
  • Comment on Authenticate HTTPS website with IE Automation

Replies are listed 'Best First'.
Re: Authenticate HTTPS website with IE Automation
by GrandFather (Saint) on Aug 24, 2016 at 04:05 UTC

    How about you show us what you have tried. We are generally happier to help you fix the same rather than just do the whole job for you.

    Premature optimization is the root of all job security
      I used LWP::UserAgent for authentication and IEAutomation for navigation and applying funtionality onto pages. But the the respopnse content after the authentication is not the one which could be passed to IEAutomation object. Thus after initialsing $ie object it is again asking for user id password. Please have a look over the code.
      my $URL = 'https://myurl.com'; my $user = 'rapid_perl'; my $pass = 'secret'; my $ua = LWP::UserAgent->new(); $ua->agent("USER/AGENT/IDENTIFICATION"); my $request = HTTP::Request->new(GET => $URL); $request->authorization_basic($user, $pass); my $response = $ua->request($request); my $cont_res = $response->content(); if ($cont_res=~/\<title\>Windchill\<\/title\>/i) { print "Login Successful \n"; my $ie1 = Win32::IEAutomation->new( visible => 1, maximize + => 0); $ie1->gotoURL("$URL"); sleep 15; }

        Please think about what you're doing when posting, always post fake login details.