2 messages in com.canoo.lists.webtest[Webtest] Forms with Files| From | Sent On | Attachments |
|---|---|---|
| Joe Wyrembelski | 09 Sep 2004 11:02 | |
| Marc Guillemot | 10 Sep 2004 00:37 |
| Subject: | [Webtest] Forms with Files![]() |
|---|---|
| From: | Joe Wyrembelski (jr...@xede.com) |
| Date: | 09/09/2004 11:02:54 AM |
| List: | com.canoo.lists.webtest |
Has anyone tried to submit a form that requires file input? I am, and it's not
working as easily as I thought it would.
When you use a browser to fill out a form that requires file input, it's up to
the browser to read that file from disk and stuff it into the request that it
sends to the server.
I would have hoped that HttpUnit/Webtest would have taken care of this but it
seems like they haven't ... does anyone know how to handle this case? Does
anyone have any ideas as to how to go about implemeting a test class that would
work in this case?
My form is basically the following:
<FORM name="add" ENCTYPE="multipart/form-data" ACTION="admin" METHOD=POST> File:<input name="the_file" type=file> Title:<input name="title" type=text value=""> <input name=submit type=submit value="Add Document"> </FORM>
And my web test is basically the following:
<clicklink stepid="get to add document form" href="${add.url}" /> <setinputfield stepid="Set the_file" name="the_file" value="C:\\thefile.pdf" /> <setinputfield stepid="Set title" name="title" value="web test title" /> <clickbutton name="submit" stepid="Click the submit button" /> <verifytext stepid="Verify add worked" text="web test title" />
And the error the web test spits out is basically the following:
... "Illegal parameter the_file in form" ... "Attempted to assign to parameter
'the_file' the extraneous value 'C:\thefile.pdf'."
How can you specify that the input field is a file type?
Joe




