trahulprajapati has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks I'm trying to login to a website which is using javascipt while loading. I have tried with WWW:Machanize but it is not working as WWW:Machanize not support javascript. Webpage is dynamically creating the login form as we have different option for login by selecting radio button. By simple view code it is not showing form form ,that means while loading the page it is calling javascript function and from in function form is loading. WWW:Machanize is not support javascript so is there any way by which i can login to site? I we cannot use WWW:Machanize::Firefox ,WWW::Scripter etc.. is there any way through which we can login by WWW:Machanize or somthing else? I have tried the following code:
use strict; use warnings; use LWP::UserAgent; use WWW::Mechanize; my $login_url = 'abc.xyz.com'; my $username = "abc"; my $password = "xyz123"; my $mech = WWW::Mechanize->new(); $mech -> cookie_jar(HTTP::Cookies->new()); $mech -> get($login_url); $mech->submit_form( with_fields => { "userid" => $username, "authmethod" => 'on', "username" => $username, "login-form-type" => 'pwd', "password" => $$password }, button => "btnSubmit", ); $mech->save_content('out1.txt');
|
|---|