18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Record playback does not work for uploading file

chaudharypareshchaudharyparesh Members
edited June 2011 in Sahi - Open Source
Hi All,

i want to upload one binary image file in our product from GUI. For that record script using controller.
record script like :

_setFile(_file("filename"), "");
_setFile(_file("filename"),"abc"); /*abc is file name */
_click(_button("Upload"));
_click(_button("OK"));

But when i playback using sahi controller then it's do not work.

After read some forums post related to upload add my script like

_setFile(_file("filename"),"abc");
_call(_file("filename").type = "text"); //here change file type to 'text'
_setValue(_textbox("filename"), "abc");
_click(_button("Upload"));
_click(_button("OK"));

But when i run this script , add successfully file name on textbox but when i click on OK button it's display
"HTTP 404 Web page not found"

--> my upload HTML element:
<td >width="71%"><input type="file" id="filename" name="filename"></td>


--> i also mention content-Type for more understand for mime-type

Content-Disposition: form-data; name="filename"; filename="abc"

Content-Type: application/octet-stream

--> My uploading file is binary and it's approx 80 MB

Anybody know which mine-type need to add in mime-types.mapping file for binary file

Waiting for Reply,
Thanks in Advance

Comments

  • narayannarayan Administrators
    Hi Paresh,

    Could you check the following?

    1) Check if there are any file not found exceptions on the Sahi Console. Make sure that the file path "abc" gives the full path of the file, or a path relative to userdata directory

    2) Can you check the URL of the 404 page? Also check what the correct URL should be (without using Sahi). If they are different, try passing the correct URL as the third parameter to _setFile (http://sahi.co.in/w/_setFile) or post the 2 URLs and we will show you how to do it.

    Regards,
    Narayan
  • Hi,

    it's work using third argument in _setFile syntax.

    Thanks
This discussion has been closed.