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 - 3016 code and false response
Hi,
I am testing file upload functionality in pop-up window, i am setting filepath value into the textbox using _setfile
here is the code
_call(_file("file[]").type = "text");
_setValue(_textbox("file[]"), "C:\test1.txt");
_click(_button("Upload"));
the test script is showing success but in pop-up window its displaying 3016 code and i checked firebug its giving haserrors request for that response is false.
please can anyone help me on this
Thanks,
Priya.
I am testing file upload functionality in pop-up window, i am setting filepath value into the textbox using _setfile
here is the code
_call(_file("file[]").type = "text");
_setValue(_textbox("file[]"), "C:\test1.txt");
_click(_button("Upload"));
the test script is showing success but in pop-up window its displaying 3016 code and i checked firebug its giving haserrors request for that response is false.
please can anyone help me on this
Thanks,
Priya.
Tagged:
Comments
_setValue(_textbox("file[]"), "C:\\test1.txt");
These statements are needed only if there is javascript validation for that particular form field.
You need to invoke
_setFile(_file("file[]"), "C:\\test1.txt");
to tell the proxy that a file needs to be appended to the form.
So try:
thanks for your responses, and its working fine for first file, i'll give example below
<input type="file" name="file[]" />
<input type="file" name="file[]" />
<input type="file" name="file[]" />
<input type="file" name="file[]" />
the below code is working fine for the first file field:
_setFile(_file("file[]"), "C:\\test1.txt");
_call(_file("file[]").type = "text");
_setValue(_textbox("file[]"), "C:\\test1.txt");
_click(_button("Upload"));
but the following code is not working for next file fields:
_setFile(_file("file[][1]"), "C:\\test1.txt");
_call(_file("file[][1]").type = "text");
_setValue(_textbox("file[][1]"), "C:\\test1.txt");
_click(_button("Upload"));
so just help on this, and after uploading in pop-up window i need to refresh the parent page using function, how can i refresh the parent page in child page using sahi.
Thanks,
Priya.
1) I had a look at the file upload code, and realized that the file upload will work only for file fields with unique names. In your case you are using multiple file fields with the same name "file[]". So it will work only for the first field. We will address this issue in a coming release.
2) To refresh the page, you could try
_call(parent.location.reload());
or
_call(parent.location.href = parent.location.href);
You could also try top.location instead of parent.location