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');

Replies are listed 'Best First'.
Re: Not able Login into webpage which use javascript while load
by haukex (Archbishop) on Jun 22, 2017 at 16:05 UTC

      thank for your prompt reply!

      I have insatll WWW::Mechanize::Firefox module by cpan but it is not working, it says tried but it is not working WWW::Mechanize::Firefox

      Failed to connect to , problem connecting to "localhost", port 4242: Connection refused at

      i have search to resolve it says mozrepl is require, but i'm using putty to login to server so how can i download? Is there any alternative way by which i can login to that form?

Re: Not able Login into webpage which use javascript while load
by NetWallah (Canon) on Jun 22, 2017 at 20:52 UTC
    Did you notice you had 2 "$" signs at:
    "password" => $$password

                    Once it hits the fan, the only rational choice is to sweep it up, package it, and sell it as fertilizer.

Re: Not able Login into webpage which use javascript while load
by marto (Cardinal) on Jun 22, 2017 at 15:29 UTC

    "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"

    Why can't use use them? An alternative would be to contact the site asking if they have an API you can use, rather than screen scraping.

A reply falls below the community's threshold of quality. You may see it by logging in.