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.
Sahi 5xx Error when upload a file
zwdhd
Members
hi all,
I am using sahi to upload a file.
I changed the type of the 'file' element to 'text', because the uploaded file should not be empty.
After I submit the form, here goes the problem.
The web server threw a 500 Internal Server Error at Thu May 05 09:18:31 CST 2011.
How can I handle it?
I am using sahi to upload a file.
I changed the type of the 'file' element to 'text', because the uploaded file should not be empty.
After I submit the form, here goes the problem.
The web server threw a 500 Internal Server Error at Thu May 05 09:18:31 CST 2011.
How can I handle it?
Comments
Can you post the Sahi script which you are using to upload the data.
Also, post the HTML of the file upload element.
Regards
Sumitra
"_setFile(_file("fileContent"), "D:\\amaltsev\\sahi\\userdata\\test22.docx");
if (_isIE()){
_call(_file("fileContent").outerHTML = _file("fileContent").outerHTML.replace(/type=file/, "type=text"));
}else{
_call(_file("fileContent").type = "text");
}
_setValue(_textbox("fileContent"), "test22.docx");
_click(_button("button twDocAttachmentOkButton"));
"
Kindly check if you are getting any error on Sahi console and post the content of it.
Can you post the logs of the script?
Regards
Sumitra
"INFO: realm=; getRequestingScheme()=ntlm
29.07.2011 13:58:13 net.sf.sahi.config.SahiAuthenticator getPasswordAuthenticati
on
INFO: getRequestingProtocol() = http
29.07.2011 13:58:13 net.sf.sahi.config.SahiAuthenticator getPasswordAuthenticati
on
INFO: realm=; getRequestingScheme()=ntlm
url: **** (there is correct url here)
command: FileUpload_appendFiles
29.07.2011 13:59:02 net.sf.sahi.command.FileUpload appendFiles
INFO: Uploading: fileName =
\amaltsev\sahi\userdata\test22.docx
29.07.2011 13:59:35 net.sf.sahi.config.SahiAuthenticator getPasswordAuthenticati
on
INFO: getRequestingProtocol() = http
29.07.2011 13:59:35 net.sf.sahi.config.SahiAuthenticator getPasswordAuthenticati
on"
The log looks like this:
"_popup("Регистрация нового договора")._click(_button("Добавить документ")); at 29.07.2011 13:58:43
_popup("Регистрация нового договора")._setSelected(_select("fileType"), "Файл"); at 29.07.2011 13:58:43
_popup("Регистрация нового договора")._click(_file("fileContent")); at 29.07.2011 13:58:43
_popup("Регистрация нового договора")._setFile(_file("fileContent"), "D:\\amaltsev\\sahi\\userdata\\test22.docx"); at 29.07.2011 13:58:43
_sahi.setServerVar('___lastValue___1311933523709', _isIE()); at 29.07.2011 13:58:43
_popup("Регистрация нового договора")._call(_file("fileContent").type = "text"); at 29.07.2011 13:58:43
_popup("Регистрация нового договора")._setValue(_textbox("fileContent"), "test22.docx"); at 29.07.2011 13:58:43
_popup("Регистрация нового договора")._click(_button("button twDocAttachmentOkButton")); at 29.07.2011 13:58:44
The web server threw a 500 Internal Server Error at Fri Jul 29 13:58:44 MSD 2011. at 29.07.2011 13:58:44"
Can you check with the latest version of Sahi?
Regards
Sumitra
@browser.file("user[company_attributes][qualifications_attributes][0][pictures_attributes][0]Attachment not found.
<input id="user_company_attributes_qualifications_attributes_0_pictures_attributes_0_attach" class="need_checked" type="file" onpaste="return false;" onkeypress="return false;" onblur="return check_company_qualifications_picture(this);" name="user[company_attributes][qualifications_attributes][0][pictures_attributes][0]Attachment not found.
Sahi's "file" method takes care of file upload. You can use that instead of calling an execute_step. Having said this, please verify your input id.
According to your html, it is "user_company_attributes_qualifications_attributes_0_pictures_attributes_0_attach" but the script given has "user[company_attributes][qualifications_attributes][0][pictures_attributes][0]Attachment not found.
This code works on any browser other than IE.
For IE, you will have to use
Regards,
dkulkarni