18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
File upload Issue
I have already gone through few posts relating to this issue but could not find any solution.
I am trying to upload a file. The recorder generates:
_click(_div("...[1]"));
_setFile(_file(""), "test.XML");
_setFile(_file("file"), "test.XML");
_click(_div("Upload[1]"));
This does not work.
I tried to modify this into:
_click(_div("...[1]"));
_call(_file("file").type="text");
_setValue(_textbox("file"), "test.XML");
_click(_div("Upload[1]"));
I get a java script error on the application. This was tried in both IE and FF.
Snippet for the fileuplaod form. (Upload button is not part of the snippet)
<form target="FormPanel" action="../uploadFile" enctype="multipart/form-data" method="post">
<input type="file" name="file" size="70">
</form>
Any help would be greatly appreciated.
I am trying to upload a file. The recorder generates:
_click(_div("...[1]"));
_setFile(_file(""), "test.XML");
_setFile(_file("file"), "test.XML");
_click(_div("Upload[1]"));
This does not work.
I tried to modify this into:
_click(_div("...[1]"));
_call(_file("file").type="text");
_setValue(_textbox("file"), "test.XML");
_click(_div("Upload[1]"));
I get a java script error on the application. This was tried in both IE and FF.
Snippet for the fileuplaod form. (Upload button is not part of the snippet)
<form target="FormPanel" action="../uploadFile" enctype="multipart/form-data" method="post">
<input type="file" name="file" size="70">
</form>
Any help would be greatly appreciated.
Comments
It should be a mix of both:
Let me know if this works, else we will have to dig in deeper.
Regards,
Narayan
I tried to use the same scenario for Sahi Java API and couldn't find any method to do it... :-(
Please, help
In the last released open source version, something like this should work
Regards,
Narayan
I have tried this method in IE and Firefox. But in both it seems to fail.
In IE - No result for the step execution. The next steps fail as the upload popup is not removed.
In FF - I get a java script error if I change the type to text.
Regards,
Ganesh
For now, it is solved for Firefox. For Internet Explorer, Narayan and his team are looking into the solution. Will post once I receive from them.
Solution for Firefox:
The _setFile and changing of the type in combination did the trick.
The java excerpt of the code is: