Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How to fill textarea of a webpage fetched using WWW::Mechanize::Firefox ?

by Gangabass (Vicar)
on May 10, 2015 at 00:38 UTC ( #1126218=note: print w/replies, xml ) Need Help??


in reply to How to fill textarea of a webpage fetched using WWW::Mechanize::Firefox ?

What about simple XPath (if you have only one textarea):
my $textarea = $mech->xpath('//textarea', one => 1); $textarea->value("somevalue");

Replies are listed 'Best First'.
Re^2: How to fill textarea of a webpage fetched using WWW::Mechanize::Firefox ?
by strawperl (Initiate) on May 10, 2015 at 05:35 UTC

    I guess this is the solution that Corion suggested (to fetch the textarea as an object and then use the ->value method). I used this code trying both the absolute xpath and '//textarea' (the page has only one textarea).

    line 52 my $textarea = $mech->xpath('//textarea', one => 1);

    line 53 $textarea->value("somevalue");

    I got the below error-

    MozRepl::RemoteObject: TypeError: f.apply is not a function at getpage.pl line 53

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1126218]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2020-05-26 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (150 votes). Check out past polls.

    Notices?