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.
how to browse the file and upload to the database
below is the scenario:
When some button is clicked a popup is opened having a browser button and import button
2. On clicking the browse button it Will open a "file browser" to select the desired file.
3. the user will browse and select the file and click on Open.
4. On clicking the import button, the selected file will be uploaded to the DataBase.
i am not able to record these scenarios. please tell me the exact code need to be written for complete scenario
I have used _setFile(_file("fileid") , path) but there is error coming that form name not is null.
then I entered (Form name:FileId) then showing error as name is null.
any body pls help.. its very urgent.
thanks,
shipra
When some button is clicked a popup is opened having a browser button and import button
2. On clicking the browse button it Will open a "file browser" to select the desired file.
3. the user will browse and select the file and click on Open.
4. On clicking the import button, the selected file will be uploaded to the DataBase.
i am not able to record these scenarios. please tell me the exact code need to be written for complete scenario
I have used _setFile(_file("fileid") , path) but there is error coming that form name not is null.
then I entered (Form name:FileId) then showing error as name is null.
any body pls help.. its very urgent.
thanks,
shipra
Comments
Is there any way to automate this using sahi?
Can we call an external exe or program to do this?
Thanks,
Rahul
Yes, you can modify any part of code in the application using sahi (by modifying methods & attributes of any object).
If your issue is same as Shipra then : It looks like a new window is opened when you click on Submit button. If that is the case, you need to add _popup("") before the steps that happen on the newly opened window.
Here is an example:
http://sahi.co.in/forums/viewtopic.php?id=1920
For more details about _setFile() have a look at :
http://sahi.co.in/w/_setFile
Let me know if you face any problem.
Regards
Sumitra
Thanks for your reply.
I will try it out again.
Regards,
Rahul
Pls try this ,
_setFile(_file("versionFile"),"path");
if (_isIE())
{
_call(_file("versionFile").outerHTML = _file("versionFile").outerHTML.replace(/type=file/, "type=text"));
}
else
{
_call(_file("versionFile").type = "text");
}
_setValue(_textbox("valueEditable"),"path");
_setValue(_textbox("name"), "File name");
_click(_button("Add"), "Add");
add or submit whatever is the import one.
try
{
if(_getCellText(_table("errorBox[1]")).indexOf("Error adding new item") > 0)
{
_navigateTo("path",true);
> path where you want to navigate
}
}
catch(e){}
can you please tell what is "VersionFile" depicts in "_setFile(_file("versionFile"),"path");"
As i have to upload file to the application from any drive. and not getting exact syntax for that
thank you