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 am getting this error when i try to upload photo or text file
_setFile(_file("imgFileUpload"), "scripts/Capture.JPG");
TypeError: 'form' is null or not an object
No trace available
Click for browser script at Feb 21, 2012 6:36:28 PM
Here is my script
_popup(/App.*/)._click(_imageSubmitButton("imgNameFrontView"));
_popup(/UpdateAllImg.*/)._click(_submit("Add New"));
_popup(/UpdateImg.*/)._blur(_textbox("dttPhotoDate\$Date\$KPIDttmCtrl"));
_popup(/UpdateImg.*/)._blur(_textbox("dttPhotoDate_Time_t"));
_popup(/UpdateImg.*/)._highlight(_textbox("dttPhotoDate_Time_t"));
_popup(/UpdateImg.*/)._blur(_textbox("dttPhotoDate_Time_t"));
_popup(/UpdateImg.*/)._click(_textbox("dttPhotoDate_Time_t"));
//set the file
_setFile(_file("imgFileUpload"), "scripts/Capture.JPG");
// Change the "type" attribute of file field
if (_isIE()){
_call(_file("imgFileUpload").outerHTML = _file("imgFileUpload").outerHTML.replace(/type=file/, "type=text"));
}else{
_call(_file("imgFileUpload").type = "text");
}
// Set the value into the textbox
_popup(/App.*/)._setFile(_file("imgFileUpload"), "scripts/Capture.JPG");
_setFile(_file("imgFileUpload"), "scripts/Capture.JPG");
TypeError: 'form' is null or not an object
No trace available
Click for browser script at Feb 21, 2012 6:36:28 PM
Here is my script
_popup(/App.*/)._click(_imageSubmitButton("imgNameFrontView"));
_popup(/UpdateAllImg.*/)._click(_submit("Add New"));
_popup(/UpdateImg.*/)._blur(_textbox("dttPhotoDate\$Date\$KPIDttmCtrl"));
_popup(/UpdateImg.*/)._blur(_textbox("dttPhotoDate_Time_t"));
_popup(/UpdateImg.*/)._highlight(_textbox("dttPhotoDate_Time_t"));
_popup(/UpdateImg.*/)._blur(_textbox("dttPhotoDate_Time_t"));
_popup(/UpdateImg.*/)._click(_textbox("dttPhotoDate_Time_t"));
//set the file
_setFile(_file("imgFileUpload"), "scripts/Capture.JPG");
// Change the "type" attribute of file field
if (_isIE()){
_call(_file("imgFileUpload").outerHTML = _file("imgFileUpload").outerHTML.replace(/type=file/, "type=text"));
}else{
_call(_file("imgFileUpload").type = "text");
}
// Set the value into the textbox
_popup(/App.*/)._setFile(_file("imgFileUpload"), "scripts/Capture.JPG");
Comments
Can you specify the error displayed on the Sahi console?
Ensure that the file path is specified correctly and the _file element is identified with appropriate identifier with popup id if exists.
Regards,
Theeran.
The form is validating before submission. how to proceed after this , its says not a valid file.