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

Hi, i want to adress a textfield in a html page, but its not part of any form.It says in the documentation: This applies to the current form (as set by the "form_name()" or "form_number()" method or defaulting to the first form on the page). But there is no form. I looked at the html code and it says something like :<button type="submit" id="InputButton1"></button> I tried to adress it with the $mech->field() method by mentioning its ID but its not working. How can i address these fields that are not in any form. Or am i doing something else wrong? Ty

Replies are listed 'Best First'.
Re: using WWW::Mechanize to adress fields
by zentara (Cardinal) on Jun 13, 2014 at 14:49 UTC
    It wont install: make test had returned bad status, won't install without force Failed during this command: SPROUT/JE-0.060.tar.gz : make_test NO SPROUT/WWW-Scripter-Plugin-JavaScript-0.008a.tar.gz: make_test NO 2 dependencies missing (JE,JE::Destroyer); additionally test harness failed Can you tell me what is the problem and how i can resolve this?

    I just installed it via CPAN and got the same error. The problem is that cpan:://JE is failing the tests, and CPAN won't install without a force. I manually downloaded and installed JE then CPAN installed WWW::Scripter::Plugin::JavaScript just fine.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

      Tried that too, not listed by PPM and won't install manually. Any suggestions? I will look some more and otherwise i'll repost a question, ty.

        not listed by PPM and won't install manually

        In addition to the cpan way of forcing with notest, which Anonymous Monk so generously showed you, I did it the old fashioned way.

        Go to JE and download it from cpan JE download
        Then tar -xvf the tarball.
        Then:
        "perl Makefile.PL"
        make
        sudo make install

        The go back to the cpan utlity:
        $ cpan install WWW::Scripter::Plugin::JavaScript

        If that don't work, tell us what errors you are getting.


        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku ................... flash japh

        Tried that too, not listed by PPM

        zentara wasn't talking about PPM

        and won't install manually.

        sure it will, easiest thing in the world

        cpanp -i --skiptest Modulename --force cpan -f -i -T Modulename cpanm --install --notest --force Modulename cpanm -i -n -f Modulename

        Any suggestions? I will look some more and otherwise i'll repost a question, ty.

        Don't repost, figure it out :)

Re: using WWW::Mechanize to adress fields
by Anonymous Monk on Jun 13, 2014 at 07:56 UTC

    Hi, i want to adress a textfield in a html page, but its not part of any form

    Seeing how WWW::Mechanize uses HTML::Form which only deals with stuff in forms, you cannot adress any such textfield, it doesn't exist in the HTML::Form object

    The good news is you don't need to submit any form object to make get/post requests, just use the get/post method as documented

     $ua->get( $url , $field_name => $value, ... )

Re: using WWW::Mechanize to adress fields
by Anonymous Monk on Jun 13, 2014 at 08:27 UTC

    hmm, it says http method Post is not supported by this Url. The get method works though. I am trying to enter a chat similar to the one here. Any suggestions?

      Have you checked whether that page uses Javascript? WWW::Mechanize does not support Javascript.

        It does. But the code is in different files. I dont know what to make of it all. Is there a similar module that has support for Javascript? All i have to do is pass a value and simulate a button click it appears.

Re: using WWW::Mechanize to adress fields
by Anonymous Monk on Jun 14, 2014 at 09:38 UTC

    Yes, its working. After watching the HTTP traffic i copied some parameters and i can reach the chat. Thanks for the advice, bye bye.