I’m having trouble with setting a field on a web page.
Here is how I’m attempting to do this:
##
## fourth page
##
ok($mech->form_name('ftp_information'),"getting the ftp_information form");
ok($mech->field('pFTPHostname','dogs'), 'Setting ftp host name to dogs');
ok($mech->field('pFTPUsername','dogs'), 'Setting ftp user name to dogs’);
It fails on the pFTPHost name;
Here’s the raw html :
<div id='myForm'>
<span class='required'>*</span> indicates Required Field<br/><br/>
<table border='0' cellpadding='3' cellspacing='0' width='100%'>
<form name='ftp_information' method='POST' action='file_admin.cgi'>
<input type='hidden' name='rm' value='process_ftp_information'>
<input type='hidden' name='CGISESSID'
value='d02df1fb65eb3b2058770f5e395f1451'>
<input type='hidden' name='ftp_information' value='1'>
<tr>
<td class='fieldLabel' width='45%'>
FTP Hostname or IP Address:
</td>
<td class='field'>
<input type='text' class='text' name='pFTPHostname' value='' ><span
class='required'> *</span>
</td>
</tr>
<tr>
<td class='fieldLabel'>
FTP Username:
</td>
<td class='field'>
<input type='text' class='text' name='pFTPUsername' value='' ><span
class='required'> *</span>
</td>
</tr>
<tr>
<td class='fieldLabel'>
FTP Password:
</td>
<td class='field'>
<input type='text' class='text' name='pFTPPassword' value='' ><span
class='required'> *</span>
</td>
</tr>
<tr>
<td colspan='2' align='center'><br/><input type='submit'
value='Continue' class='button'></td>
</tr>
</form>
</table>
</div>
The form :
$VAR1 = bless( {
'accept_charset' => 'UNKNOWN',
'action' => bless( do{\(my $o =
'http://cportal-test.dfw0.hypercube-llc.com/html/file_admin.cgi')}, 'URI::http'
),
'attr' => {
'method' => 'POST',
'name' => 'ftp_information'
},
'default_charset' => 'UTF-8',
'enctype' => 'application/x-www-form-urlencoded',
'inputs' => [
bless( {
'name' => 'rm',
'readonly' => 1,
'type' => 'hidden',
'value' => 'process_ftp_information',
'value_name' => ''
}, 'HTML::Form::TextInput' ),
bless( {
'name' => 'CGISESSID',
'readonly' => 1,
'type' => 'hidden',
'value' => '3facae5659bca900e5ef3d6c302aad4e',
'value_name' => ''
}, 'HTML::Form::TextInput' ),
bless( {
'name' => 'ftp_information',
'readonly' => 1,
'type' => 'hidden',
'value' => '1',
'value_name' => ''
}, 'HTML::Form::TextInput' ),
bless( {
'class' => 'text',
'name' => 'pFTPHostname',
'type' => 'text',
'value' => '',
'value_name' => '*'
}, 'HTML::Form::TextInput' ),
bless( {
'class' => 'text',
'name' => 'pFTPUsername',
'type' => 'text',
'value' => '',
'value_name' => '*'
}, 'HTML::Form::TextInput' ),
bless( {
'class' => 'text',
'name' => 'pFTPPassword',
'type' => 'text',
'value' => 'cats',
'value_name' => '*'
}, 'HTML::Form::TextInput' ),
bless( {
'class' => 'button',
'type' => 'submit',
'value' => 'Continue',
'value_name' => ''
}, 'HTML::Form::SubmitInput' )
],
'method' => 'POST'
}, 'HTML::Form' );