This is my first exposure to perl Mech when I am trying to autofill a php script. As per perl Mechaize docs, there are numerous functions to fill out a text field and submit. However, what if the script doesn't have any form tag? Such as this one below:
- <html>
-
<body>
-
Enter Hostname:
-
<input type="text" name="host_name" id="host_input"/>
-
<input type="submit" value="Investigate!" onClick="populate();"/>
-
<br/>
-
</body>
-
</html>
For brevity's sake, have only produced relevant html source here. There is no mention of a form tag anywhere in this php page. It displays a text field for entering host name and a submit button which when clicked calls a php function 'populate()'.
How can I fill up/submit this form when there is no form tag?
- my $mech=WWW::Mechanize->new(autocheck=>1);
-
$mech->cookie_jar($cookie_jar);
-
$mech->get($url);
On examining the $mech object created above, $mech->forms is an empty array and hence form methods defined in Mechanize barf on 'undefined value'.
Thanks folks