Subject: | Cannot set value of an input field of type file |
Running a perl test scrip using Win32::IE::Mechanize to test a web page.
I find that I cannot set the value from the perl script of an <imput type="file"> field on a web form that is being automated.
The script that I am running is: -
my $response = $mech->get( "$TESTURL/ManageProjects.aspx" );
$mech->follow_link(text=>"Autotest");
sleep(1);
$mech->form_name( 'f' );
$mech->set_fields( fileImport=> getcwd()."/foreign_test_data.txt");
The last line does not work correctly. I have worked around this my telling the used to select the required file manually at this point, and then press return to continue. Win32::IE::Mechanize has no problem with clicking on form buttons, following links, etc.
The HTML that is not being set correctly is...
...
<form name="f" method="post" action="ManageProject.aspx?projectId=22" id="f" enctype="multipart/form-data">
...
<input name="fileImport" id="fileImport" type="file" width="150" />
...