Get the xpath of upload text field thru firebug addon. Then add manual path of the file in the code. Then selenium.click('upload'). Hope this will resolve your problem
Please follow below sample to upload the your attachments.
Hope, this will help you.
Note: this is for window users.
Following steps may help u in uploading the file, replace browse and upload buttons with "element id" or "value" or "xpath of that button/link".
selenium.waitForPageToLoad("max time to load in milliseconds");
selenium.type("upload field ID", "c:\\path of file to be uploaded from system, including filename and extension");
Either u click on the browse button or the textbox, the post condition will be the upload file window.
Hence u can use any of them.
Usually user will not be able to manually add any text into the upload text field, it always opens the upload file window.
If you are able to identify the new upload window using the tool, u should not have problem in uploading a file else use selenium IDE and record your flow.
Its too much easy just on the selenium record when you are uploading something after that stop recording and change to source view from Table view and see the source. And use the same command everytime when you are uploading.
Try selenium IDE.Just record one instance.And then go to the source and give the path from where u want to upload any file. Its so simple.
One Funny thing I generally upload any pics or docs using Selenium IDE.
Thanks & Regards,
Select your file and then upload.
Another way, is to record your test case thru selenium IDE and check for the steps